Hi!
Could you please check that DBAdvGrid does not internally (GetFormattedCell function) check the grid's FormatType for its known columns, so it acts as if the grid had ftVCL.
Meanwhile, based on AdvGrid.pas, I changed this, but it will be lost in next update:
case FormatType of
ftVCL : Result := Format(fmt, [Floats[ACol, ARow]]);
ftExcel :
begin
try
{$IFDEF DELPHIXE_LVL}
Result := XlsFormat(Floats[ACol, ARow], fmt);
{$ENDIF}
except
end;
end;
end;
I'm not sure what the reason of your question / remark is.
DBAdvGrid uses the Column's setting FormatFloat when it is defined.
What different behavior do you want and for what reason?
DBAdvGrid.pas GetFormattedCell source code does not check if the grid has FormatType = ftExcel. It doesn't have a case FormatType of clause. If I use formats like '#,##0' (assign it to the grid's column) and FormatType=ftExcel, it simply doesn't work. Outputs literally '#,##0' at the cell.
It fails when it's configured at grid's column level (TDBGridColumnItem.FloatFormat).
It did not work. I believe the fix is mentioned under VCL UI Pack version 13.1.5.0, which says:
It's definetly not fixed, and now even worse. If I put ftExcel, now the grid shows with lot's of zeroes, even in columns where datafield is a TStringField. Also the fixed column shows "0" in all rows.
Just open DBAdvGrid demo CDSMasterDetail, ant set the upper grid FormatType to ftExcel, set FloatFormat to anything, and you'll get:
Design time:
Runtime:
when it should be like (running with ftVCL):
Yes, you added a ftExcel check, but it is not inside a " if IsFloat then " block, so it applies this float format to everything. Please check.
You mean we should not use ftExcel at grid level if not every cell would have a number to be formatted?
Because I didn't mean I was using "anything" as only wrong formats, but any valid excel format. The problem was that it was trying to apply the format to non float columns too.