开发者

ExpressQuantumGrid Excel export of FMTBCD fields without currency symbol and format ",0.00"

According to this DevExpress Knowledge Base entry for the ExpressQuantumGrid, Excel-Exports from a cxGrid formats FMTBCD-Fields with a currency-Symbol it is necessary to use calculated fields of type TFloatField to export FMTBCD fields wihtout the currency symbol to Excel. The example code in the Knowledge Base works as expected.

However I also 开发者_如何学Pythonneed to add a precision of two decimal digits in the exported file for the calculated field.

  • I tried to use Properties=CalcEdit with DisplayFormat=",0.00" but the export does not use the DisplayFormat of the grid column

  • I tried to set the DisplayFormat of the calculated field, but the export does not use the DisplayFormat of the data field

Using version 6.54. (I will also open a support case).


I had a similar problem wanting to export money values without the currency symbol. The only way I could do it, in the end, was to modify the source code.

I took a copy of cxGridExportLink.pas and put it in a project specific directory. Then changed line 767 (I'm using their subscription number 53 at the moment. Not sure what version that is) but it is the following line:

if (IsCurrencyItem(AItem)...
  ... then
  VarCast(Result, AValue, varCurrency);   // <--- This line

I changed varCurrency to varDouble and rebuilt my program. You'll also need a copy of cxVer.inc in the same directory.

This may well affect your 2 decimal digits requirement but it's the only way I found and it works well, so far, for us.


The issue is in the Knowledge database (since 2006):

Export - Excel - export numeric data as numbers with the same format as in the grid

Maybe it will be fixed in the future.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜