Home General
New Blog Posts: Merging Reports - Part 1 and Part 2

DisplayFormat

edited May 2004 in General
I have a variable set to the following;
DataType = dtCurrency
DisplayFormat = $#,0.00;($#,0.00)

If value is negative(-100), should it show ($100.00)? At the moment it
displays as -$100.00.

Comments

  • edited May 2004
    ---------------------------------------------
    Article: Currency Formatting in ReportBuilder
    ---------------------------------------------

    Currently when formatting currency display formats, ReportBuilder
    internally calls FloatToStrF with a ffCurrency paramter.

    This honors the Windows currency settings.

    You can override this by setting Delphi's global variables for
    DecimalSeparator and CurrencyString. You will probably want to restore
    these values after printing the report.

    Below is a simple example:

    var
    lcSaveDecimalSeparator: Char;
    lsCurrencyString: String;

    begin

    lcSaveDecimalSeparator := DecimalSeparator;
    lsCurrencyString := CurrencyString;

    DecimalSeparator := '.';
    CurrencyString := '$';

    try
    Report.Print;
    finally

    DecimalSeparator := lcSaveDecimalSeparator;
    CurrencyString := lsCurrencyString;
    end;


    end;



    For the end-user solution you may to code an event-handler
    for the Report.Template.OnLoadEnd event to setup the proper settings.


    --
    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
This discussion has been closed.