Display the field as a number when exported to excel file

Posted by: yosef.teferi on 20 June 2024, 8:33 am EST

  • Posted 20 June 2024, 8:33 am EST

    I have a limited version of Active report to design and create a report using rpx template. One of the report requirements is to export to an Excel file. however, when the report is exported to the excel file, the column is a text, and I would like the column to be a number field so I can do other calculations. Is there a simple way to force the field to be a number field?

    the report column are generated from the oracle database and using a datareader

    I tried to use float.parse and still the exported values showed as a text not a number.

    I would like to have a way to show the value as a number if there is a value otherwise, none in the excel cell. Please let me know if there is a way to handle this.

    rpt.Fields[“AirDryWt”].Value = float.Parse(reader1[“AirDryWt”].ToString());

    since it is a limited version I try to use below script I get an error.	
    	float.TryParse(inputString, out float tryParsedFloat);
    	Console.WriteLine($"Using float.TryParse(): {tryParsedFloat}");
    
  • Posted 21 June 2024, 7:50 am EST - Updated 21 June 2024, 7:55 am EST

    Hi Josie,

    Please set the control’s OutputFormat property as ‘#,##0.00’. This will ensure that Excel recognizes the field as Number.

    Please refer to the attached sample report and screenshot.

    OutputFormatReport.zip

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels