Page 1 of 1

Exporting Numbers to Excel

Posted: Fri Apr 27, 2018 5:54 pm
by RomanPer
I have a report that has a number of numeric fields. Each has been formatted as a number with different quantity of decimal places (some have 0, one has 5). All the fields are displayed properly in PDF output. However, when exporting the report to Excel, all the numeric fields are reset to 2 decimal points. Any ideas on an easy fix? Thanks in advance!

Re: Exporting Numbers to Excel

Posted: Mon Apr 30, 2018 5:27 am
by Edward
Hi Roman,

Please try to use ExcelValue property, please check a sample in this topic:
viewtopic.php?&t=407

Thank you,
Edward

Re: Exporting Numbers to Excel

Posted: Mon Apr 30, 2018 8:37 pm
by RomanPer
Thanks Edward. I looked into it but I can't find much help on the Format function that I could use in that property.

Re: Exporting Numbers to Excel

Posted: Tue May 01, 2018 5:56 am
by Edward
Hi Roman,

Could you please try to get the 'string' representation of that number without any formatting and to pass it to the ExcelValue, similar as per that sample, i.e. :

Code: Select all

public void Text1_GetExcelValue(object sender, Stimulsoft.Report.Events.StiGetExcelValueEventArgs e) 
{ 
  e.Value = "123456.78901"; 
} 
Thank you,
Edward

Re: Exporting Numbers to Excel

Posted: Fri May 04, 2018 6:16 am
by RomanPer
Thank you Edward. I'll try it but I do need to format the numbers in specific formats. So, first, it's weird as to why Stimulsoft doesn't keep the formatting as defined in the properties. Second, do you know where I can find information on the syntax of the Format function?

Re: Exporting Numbers to Excel

Posted: Fri May 04, 2018 9:47 pm
by Edward
Hi Roman,

No problem!

Please check the following topic:
https://www.stimulsoft.com/en/documenta ... atting.htm

And for the format function if you require some extra functionality, please feel free to use the standard .Net formatting functions as follows:
https://docs.microsoft.com/en-us/dotnet ... at-strings

And some more techniques for you:
viewtopic.php?t=4354

Thank you,
Edward