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.

Wed Oct 11, 2017 5:22 pm

I have run across an issue regarding saving a XLS file into a CSV file using comma delimiter. I am attaching the actual excel file I used for the test and the output file that was produced.

The problem resides in the fact that I have a number in a column that has a comma as the number separator. This comma is being copied as is into the comma delimited file but no quotes are added to tell the system that the comma is not an actual field separator.

Here is the code that was used

Code: Select all
            Workbook workbook = new Workbook();
            workbook.LoadFromFile(FilePath);
            Worksheet sheet = workbook.Worksheets[0];
            sheet.SaveToFile(SavePath, delimiter.ToString(), Encoding.ASCII);
Attachments
test.zip
(4.12 KiB) Downloaded 240 times

Talsbard
 
Posts: 14
Joined: Wed Oct 12, 2016 9:27 pm

Thu Oct 12, 2017 3:58 am

Dear Talsbard,

Thanks for your inquiry.
I have noticed the issue and posted it to our Dev team. We will inform you once there is any progress.
Sorry for the inconvenience caused.

Sincerely,
Betsy
E-iceblue support team
User avatar

Betsy.jiang
 
Posts: 3099
Joined: Tue Sep 06, 2016 8:30 am

Tue Oct 17, 2017 2:19 pm

Could I please get a pointer to an article or some example code of how I can turn all of the columns into text columns without losing any of the number or date formats? This way I can at least put an interim solution in while waiting for you to fix the current bug.

Thank you

Talsbard
 
Posts: 14
Joined: Wed Oct 12, 2016 9:27 pm

Wed Oct 18, 2017 3:47 am

Dear Talsbard,

Thanks for your inquiry.
There is an interim solution, please change the separator, set semicolon as the separator.
Code: Select all
            sheet.SaveToFile("11853.csv", ";", Encoding.UTF8);


Sincerely,
Betsy
E-iceblue support team
User avatar

Betsy.jiang
 
Posts: 3099
Joined: Tue Sep 06, 2016 8:30 am

Wed Oct 18, 2017 1:52 pm

I appreciate your help in trying to come up with a different solution but I have a specific customer requirement I have to meet. That requirement involves returning a comma delimited file. I don't have a lot of time to fulfill this requirement and since our time zone difference makes me have to wait an entire 24 hours to get an answer to my inquiry I am hoping you can help with my original query. That is how do I turn all of the columns into text columns without losing any of the numbering formats so I can export with commas and quotes? Either that or I need a fix to the actual bug.

Thank you

Talsbard
 
Posts: 14
Joined: Wed Oct 12, 2016 9:27 pm

Thu Oct 19, 2017 2:37 am

Dear Talsbard,

Sorry for the different time zone and so sorry that the temporary solution doesn't help you.
After further investigation, we found another temporary solution, please use following code.
Code: Select all
            //add this line
            sheet.Range["B2"].Text = sheet.Range["B2"].DisplayedText;
            sheet.SaveToFile("11853.csv", ",", Encoding.ASCII);

And I just got information from our Dev team that the issue has been solved and it is under test phase. When the hotfix is available, we will let you know immediately. Sorry for the inconvenience caused.

Sincerely,
Betsy
E-iceblue support team
User avatar

Betsy.jiang
 
Posts: 3099
Joined: Tue Sep 06, 2016 8:30 am

Thu Oct 19, 2017 9:26 am

Dear Talsbard,

Now the hotfix is available.
http://www.e-iceblue.com/downloads/hot_ ... 12.100.zip
If there is any question, please let us know.

Sincerely,
Betsy
E-iceblue support team
User avatar

Betsy.jiang
 
Posts: 3099
Joined: Tue Sep 06, 2016 8:30 am

Thu Oct 19, 2017 4:57 pm

Seems to be working so far. Thank you for your help. If anything shows up unexpected I will let you know.

Talsbard
 
Posts: 14
Joined: Wed Oct 12, 2016 9:27 pm

Fri Oct 20, 2017 1:26 am

Dear Talsbard,

Thanks for your feedback.
Please feel free to contact us if there is any question.

Sincerely,
Betsy
E-iceblue support team
User avatar

Betsy.jiang
 
Posts: 3099
Joined: Tue Sep 06, 2016 8:30 am

Return to Spire.XLS