Hide column in DB cross-tab for FastReport

2019-07-22 14:04发布

问题:

I've been trying to hide column from a DB cross-tab in FastReport when the column header Value is 14001 ; but is not work down syntax !!!

My Report

Here's the code:

procedure DBCross2OnCalcWidth(ColumnIndex: Integer; ColumnValues: Variant;var Width: Extended);
begin 
if (VarToStr(ColumnValues[0]) = '14001') then 
    Width := 0;
end;

回答1:

Try add procedure trigged on print and collection HeaderValues[0]

procedure DBCross2OnPrintColumnHeader(Memo: TfrxMemoView; HeaderIndexes, HeaderValues, Value: Variant);
begin
  if (VarToStr(HeaderValues[0]) = '14001') then
  begin
    Memo.Width := 0;
    Memo.Height := 0;
    Memo.Printable := false;
    Memo.Visible := false;                          
  end;                      
end;