I write some values with following code into Grid.
SGExport.Cells[ColWert, Zeile] := Wert; //this value is either a real value or text. Therefore I write is as text into cell.
If I save via AdvGridExcelIO and open with excel, it shows always as text, even it is a real value.
Can I convert this value so that excel recognizes as real value?
You can use the AdvGridExcelIO.OnGetFormat event to define the desired cell format in the exported XLS file.
Thank you.
I will try tomorrow.
I tried following code, but it doesn't work.
procedure TfShowValues.AdvGridExcelIO1CellFormat(Sender: TAdvStringGrid;
const GridCol, GridRow, XlsCol, XlsRow: Integer; const Value: WideString;
var Format: TFlxFormat);
begin
Format.Format := '###0.00';
Format.Font.Name := 'Calibri';
end;
The font does not change. It's always Tahoma, same as original grid.
Sorry, the font settings are not used. The TFlxFormat class contains a font for internal purposes, but by design, the font set for the cell is used. You can set the grid cell font either via grid.OnGetCellColor or via grid.FontNames[col,row] / grid.FontSizes[col,row] / grid.FontColors[col,row]
Thank you for reply.
But it seems, that Format.Format := '###0.00'; is also not working?
Or doing I'm something wrong?
What exact value do you have in the grid cell?