Dynamic formatting
FR309/D5ENT
I need assign the display format to cells on DBCross in run-time.
I'm using the event OnPrintCell for change the property DisplayFormat, but not result.
Sorry, for my english
Regards
I need assign the display format to cells on DBCross in run-time.
I'm using the event OnPrintCell for change the property DisplayFormat, but not result.
procedure Page1OnBeforePrint(Sender: TfrxComponent);
begin
 FmtMoney := '%2.2m';
 FmtDecimal := '%g';
end;
procedure DBCross1OnPrintCell(Memo: TfrxMemoView; RowIndex, ColumnIndex, CellIndex: Integer; RowValues, ColumnValues, Value: Variant);
begin
 if DBCross1.IsGrandTotalRow(RowIndex) then
 begin
  case CellIndex of
   0: Memo.DisplayFormat.FormatStr := FmtMoney;
   1: Memo.DisplayFormat.FormatStr := FmtDecimal;
  end;
 end;
end;
Sorry, for my english
Regards
Comments
Memo.Text := Format('%2.2m', [Value]);
Note that you should check for Null values. Also in the OnCalcWidth event you should calculate the new width (to increase width of cells).