Prevent rounding when exporting from excel

Hello,

I am currently stuck on a problem. I would like to export data from an excel file to a collection of Objects.

I would like to export a certain column as a string, but it can also contain numbers. However, decimal numbers are still rounded. And for numbers smaller than 0.5, it is rounded to 0 and the result as string is "".


List tags = worksheet.ExportData(START_ROW, START_COL, END_ROW, END_COL);

In the ExcelTag class, the column has the type string


Original Excel Value
Result
2"2"
1,6"2"
0,3""







7 Replies

MC Mohan Chandran Syncfusion Team January 14, 2022 08:25 AM UTC

Hi Friedhelm,


Greetings from Syncfusion.


We are unable to reproduce the issue at our end. We request you share the collection object class structure and Excel document which is used to export data to proceed further and provide you a solution at the earliest.


Regards,

Mohan.



KU Kuettner January 17, 2022 08:39 AM UTC

Hello Mohan,


thank you for the quick reply.

I have attached the affected excel file excerpt and the "ExcelTag"-Class for you.

In this example the column "Hysteresis"(G) is affected.

The export is called up as follows:


IWorksheet worksheet = workbook.Worksheets["Tags"];

if (worksheet == null)

{

        return new List<ExcelTag>();

}

 List<ExcelTag> tags = worksheet.ExportData<ExcelTag>(START_ROW, START_COL, END_ROW, END_COL);


Attachment: ExcelTag_5679d046.zip


KK Konduru Keerthi Konduru Ravichandra Raju Syncfusion Team January 18, 2022 09:56 AM UTC

Hi Friedhelm, 
 
Thanks for sharing the class file and Excel document as requested. 

This is to inform you that we are unable to reproduce the reported issue. The sample which we have tried at our end can be downloaded from the below link. 

We have also recorded a video screenshot for your reference and the same can be downloaded from below link. 

Kindly look into the sample and video screenshot and let us know if these helps. If the issue still persists, kindly share us the issue reproducing sample and confirm us in the Syncfusion XlsIO version you are using at your end, which will be helpful for investigating the query further. 

Regards, 
Keerthi. 



KU Kuettner January 20, 2022 03:28 PM UTC

 Hello,


I have found the problem. You could not recreate the problem because you got a simplified version of the Excel document.

In the original file the columns M-U are hidden (Worksheet: Tags). If I show these columns and then do the import, it works without the bug.



This means that the workaround for us will now be to leave the columns permanently displayed.

For reference, I have attached the affected Excel file in its original format


Thanks for the great support (:



Attachment: ExportConfig_20220120_155452_78b34769.7z


KK Konduru Keerthi Konduru Ravichandra Raju Syncfusion Team January 21, 2022 04:27 PM UTC

Hi Friedhelm, 
  
Thanks for sharing the Excel document. 
  
We are able to reproduce the issue reported in exported decimal values and validating it currently. We will share the validation details in 2 business days, on January 25th, 2022
  
Regards, 
Keerthi. 



KK Konduru Keerthi Konduru Ravichandra Raju Syncfusion Team January 25, 2022 04:34 PM UTC

Hi Friedhelm, 
 
We appreciate your patience. 

We have confirmed the issue as Display text of a hidden column is round off incorrectly and logged a defect report. We will include the fix for this issue in our upcoming weekly NuGet release scheduled for February 8th,2022

You can track the status of defect report through following feedback link. 

We will let you know once the new package version is available on nuget.org. 

Regards, 
Ramya. 



KK Konduru Keerthi Konduru Ravichandra Raju Syncfusion Team February 8, 2022 12:18 PM UTC

Hi Friedhelm, 

We appreciate your patience.  

We have included the fix to resolve the issue Display text of a hidden column is round off incorrectly in our weekly NuGet release version 19.4.0.50. Kindly upgrade your Syncfusion packages to this new 19.4.0.50 version and let us know if the issue is resolved. 

Regards, 
Ramya. 


Loader.
Up arrow icon