rXLSexport and currency fields

15 views
Skip to first unread message

Lodovico Saccol

unread,
Dec 5, 2024, 6:25:30 AM12/5/24
to Rosi Delphi Components
Hi,
i have a dataset with a currency formatted field.
But when I export to excel, using rXLSexport, this column is exported as normal numeric field.
Is there any way to define this column as Currency ?

Thank You

Lodovico Saccol

Tomas Rosinsky

unread,
Dec 8, 2024, 12:29:22 PM12/8/24
to Rosi Delphi Components
Hi,

currently currency field is not directly supported and it is handled as numeric field.

But you can set format by custom code in AfterExport event:

procedure TExportComps.XLSExpAfterExport(Sender: TObject);
var i, idx: integer;
begin
  idx:=0;
  for I := 0 to grEmp.Columns.Count - 1 do
  begin
    if SameText(grEmp.Columns[i].FieldName, 'Salary') then
      idx:=i;
  end;
  XLSExp.FormatCells(XLSExp.ExportedDataRange.Row, XLSExp.ExportedDataRange.Column+idx,
    XLSExp.ExportedDataRange.Rows.count, 1, '$ 0,00');
end;

I hope it helps
Tomas
Dne čtvrtek 5. prosince 2024 v 12:25:30 UTC+1 uživatel Lodovico Saccol napsal:
Reply all
Reply to author
Forward
0 new messages