Home Devices

Excel currency symbol

edited September 2014 in Devices
As part of our multi-currency support we dynamically adjust the Windows
locale settings when reports print to preview (ppFormatSettings is
updated too). Its all done via RAP in the report's BeforePrint event.
This has worked well for years. From the custom preview screen users
have the option to then export to various formats, including Excel and
if the latter is executed the currency symbol for DBText fields gets
changed to the generic '$', even though it may be previewing as '£' or
'€'. Although the RAP code doesn't get called again (why?) the machine
is still set to '£' or '€' and
TppXLSFormatStyles.GetCompatibleCurrencyDisplayFormatPos() returns the
correct format under the debugger, so any idea about what's going on?

TIA, Paul

Comments

  • edited September 2014
    No thoughts, anyone?

  • edited September 2014
    Hi Paul,

    Sorry for not responding earlier - I did not see the original post, my
    mistake.

    I tried a simple test here and did not encounter an issue. I created a
    DBText connected to the AmountPaid (currency) field of the Orders table in
    DBDemos. I did not use RAP, but used the code below to modify the
    CurrencyString and then call Report.Print. The preview and XLS export both
    reflect the correct currency symbol.

    You mention that TppXLSFormatStyles.GetCompatibleCurrencyDisplayFormatPos()
    returns the correct format. If you open the report in Excel and press the
    right mouse button over a cell and select FormatSettings does the cell
    display format have the correct currency symbol? If so, then perhaps there
    is a setting in Excel that is controlling this. I tested with Excel 2010 and
    Excel 2013.


    procedure TForm1.Button1Click(Sender: TObject);
    const
    cEuro = '€';
    cPound = '£';
    begin

    FormatSettings.CurrencyString := cEuro;
    ppFormatSettings.CurrencyString := cEuro;

    ppReport1.Print;

    end;


    -
    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com

    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
This discussion has been closed.