Skip to Content
Former Member
Aug 24, 2016 at 03:25 AM

Dynamically Change Number Format in Visual Studio


I did some searching on this site and google, and can't find a good solution to change number formatting in my Crystal Report.

This was the closest thing that I could find: ( ), but this seems to be to modify the report template itself, not the loaded report document.

I'd like my .rpt file to remain in tact. The report is financial and was initially designed for USD currency.

To handle other currencies, my solution is to add the Currency Code to the report. I also need to remove the currency symbol. I could do this in the designer. But the part that requires me to do this in code, is the need to dynamically change the thousand separator on-the-fly.

Swiss Franks show the thousand separator as 1'000.00

I'd really like to do something like this:


CrystalDecisions.CrystalReports.Engine.ReportDocument report;

report = new CrystalDecisions.CrystalReports.Engine.ReportDocument();


if (currencyCode == "CHF")


foreach (CrystalDecisions.CrystalReports.Engine.ReportObject obj in report.ReportDefinition.ReportObjects){

CrystalDecisions.CrystalReports.Engine.FieldObject fld = (CrystalDecisions.CrystalReports.Engine.FieldObject)obj;

fld.FieldFormat.NumericFormat.ThousandSymbol = "'";

//Unfortunately, ThousandSymbol doesn't exist in CrystalDecisions.CrystalReports.Engine.NumericFieldFormat.

//Only in CrystalDecisions.ReportAppServer.ReportDefModel.NumericFieldFormat as specified in the thread link above;

//...which I tried, but it doesn't seem to modify my ReportDocument to print the ThousandSymbol with the "'".




report.ExportToDisk(ExportFormatType.PortableDocFormat, pdfFileName);

/* END CODE */

Is there a way to change the FieldFormat for the ReportDocument loaded in memory? Without changing the .rpt file on disk?

I really don't want to have to maintain a separate .rpt file for every financial report that we have in our application.

I'm using Visual Studio Premium 2013 (12..21005.1)
My application is compiled with .NET 4.0

Crystal for VS (