Frequently Asked Component Specific Questions
Options |
Display all FAQ items |
Displaying items 1 to 1 of 1, page 1 of 1
<< previous next >>



Exporting numbers as text with TAdvGridExcelIO
By default, when a cell contains text like "000123" and exporting this to Excel, Excel will display this as "123". This is because by default, "000123" is recognized as a number and Excel will be default show numbers without any zero prefixes. If it is required that similar text is shown in the Excel as-is, it should be specified that TAdvGridExcelIO should export the number as text. This can be done with: 1) global setting: AdvGridExcelIO.Options.ExportCellFormats = false 2) dynamically by using the OnExportColumnFormat event Example:
procedure TForm1.AdvGridExcelIO1ExportColumnFormat(Sender: TObject; GridCol, GridRow, XlsCol, XlsRow: Integer; const Value: WideString; var ExportCellAsString: Boolean); begin if GridCol = 2 then ExportCellAsString := true; end;