Spire.XLS is a professional Excel API that enables developers to create, manage, manipulate, convert and print Excel worksheets. Get free and professional technical support for Spire.XLS for .NET, Java, Android, C++, Python.

Mon Feb 15, 2021 1:26 pm

When I convert a xlsx to csv the numbers, not convert the numbers ieee754 and the number 58288358000141 appears like 5,90191E+12
How do i convert correctly?

Thank you

ronei0612
 
Posts: 3
Joined: Fri Dec 27, 2019 6:56 pm

Tue Feb 16, 2021 9:25 am

Hello,

Thanks for your inquiry.
I simulated a xlsx file and did an initial test with our latest version(Spire.XLS Pack(Hotfix) Version:11.2.3), the converted effect is the same as the result directly converted in Microsoft Excel. If you used an older version, I suggest that you download the latest version to test again. If your issue still exists after testing, to help us further investigate it, please provide your input xlsx file as well as your currently testing result for reference. Meanwhile, how about the result if you convert your xlsx file in Microsoft Excel?

Sincerely,
Sofia
E-iceblue support team
User avatar

Sofia.Yang
 
Posts: 84
Joined: Tue Jul 14, 2020 1:41 am

Thu Feb 18, 2021 1:32 pm

Thank you for reply.
I attached the files
Attachments
vinhedo_tomados.zip
(21.32 KiB) Downloaded 117 times

ronei0612
 
Posts: 3
Joined: Fri Dec 27, 2019 6:56 pm

Fri Feb 19, 2021 5:57 am

Hello,

Thank you for providing your files.
I noticed that all the numbers 58288358000141 of your generated csv file were converted into 5.82884E+13, the effect is the same as that of using Microsoft Excel to convert directly, as shown in the attached screenshot. Kindly note that our Spire.XLS mimics the behavior of Microsoft Excel. What is your desired output effect? Could you help to share us with some screenshots for reference? Thanks in advance.

Sincerely,
Sofia
E-iceblue support team
Attachments
effect.png
effect.png (138.19 KiB) Viewed 757 times
User avatar

Sofia.Yang
 
Posts: 84
Joined: Tue Jul 14, 2020 1:41 am

Fri Feb 19, 2021 1:03 pm

Many thanks for the reply
I would like Spire to convert to numbers, just like it is in the formula bar
the number appear as 5.82884E+13, if I convert appears like this 58288400000000, but the number is 58288358000141, then I want it that way: 58288358000141

ronei0612
 
Posts: 3
Joined: Fri Dec 27, 2019 6:56 pm

Sat Feb 20, 2021 8:32 am

Hello,

Thanks for your feedback.
In order to keep the formula bar number as "58288358000141" like the attached screenshot, please use the following code to firstly set the data format, and then convert the xlsx to CSV file. If there is still any issue, just feel free to contact us.
Code: Select all
Workbook workbook = new Workbook();
workbook.LoadFromFile(@"VINHEDO_TOMADOS.xlsx");
Worksheet worksheet = workbook.Worksheets[0];
//set the data format
worksheet.Range["G1:G125"].NumberFormat = "0";
worksheet.Range.AutoFitColumns();
//convert the xlsx to csv file
worksheet.SaveToFile(@"ToCSV2.csv", ";", Encoding.UTF8);

Sincerely,
Sofia
E-iceblue support team
Attachments
effect.png
effect.png (91.35 KiB) Viewed 743 times
User avatar

Sofia.Yang
 
Posts: 84
Joined: Tue Jul 14, 2020 1:41 am

Fri Mar 05, 2021 7:19 am

Hello,

Greetings from E-iceblue.
Did my code work for you? Could you please give us a feedback at your convenience? Thanks in advance.

Sincerely,
Sofia
E-iceblue support team
User avatar

Sofia.Yang
 
Posts: 84
Joined: Tue Jul 14, 2020 1:41 am

Return to Spire.XLS