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 Apr 08, 2015 1:14 am

Hello,

We are trying to convert some XLS/XLSX files to a pipe separated file.

Code: Select all
worksheet.SaveToFile(fileExtractPath, "|");


One test file (attached) has a column of dates with Excel format "yyyy-mm-dd h:mm", however when the file is saved to the text file it comes out as, for example, "5/04/2015 5:47:00 AM".

I have found a workaround in setting the Thread's culture prior to export:

Code: Select all
CultureInfo culture = (CultureInfo)threadCulture.Clone();
culture.DateTimeFormat.ShortDatePattern = "yyyy-MM-dd HH:mm";
culture.DateTimeFormat.LongTimePattern = "";
Thread.CurrentThread.CurrentCulture = culture;


However, it would be much more preferable to output each cell in the format defined for that cell, rather than applying the same format to the entire spreadsheet.
Attachments
Plays.zip
(7.85 KiB) Downloaded 251 times

will.marriott
 
Posts: 27
Joined: Thu Oct 24, 2013 9:47 pm

Wed Apr 08, 2015 2:36 am

Hello,

Thanks for your inquiry.
I have reproduced your issue, sorry. I have posted the issue to our dev team. We will inform you immediately when it is fixed.

Sincerely,
Sweety

E-iceblue support team
User avatar

sweety1
 
Posts: 539
Joined: Wed Mar 11, 2015 1:14 am

Tue Apr 28, 2015 8:58 am

Hello,

Sorry to keep you waiting.
The new version of Spire.XLS (Spire.XLS Pack Version:7.7) solved your issue " Date Format on Save To File" has been released. Please download it via link below and have a try:
http://www.e-iceblue.com/Download/download-excel-for-net-now.html
If I miss something or you have other problems, please feel free to contact us.

Sincerely,
Sweety

E-iceblue support team
User avatar

sweety1
 
Posts: 539
Joined: Wed Mar 11, 2015 1:14 am

Tue May 05, 2015 5:26 am

Hello,

Has your question been resolved? Thanks for your feedback.

Sincerely,
Sweety

E-iceblue support team
User avatar

sweety1
 
Posts: 539
Joined: Wed Mar 11, 2015 1:14 am

Mon May 11, 2015 6:21 am

Hi Sweety,

Thank you, yes, initial testing looks good.

I will get back to you if I have any further issues.

will.marriott
 
Posts: 27
Joined: Thu Oct 24, 2013 9:47 pm

Mon May 11, 2015 8:18 am

Hello,

Please feel free to contact us, if you have any questions or needs. We are here for help.

Best Regards,
Sweety
E-iceblue support team
User avatar

sweety1
 
Posts: 539
Joined: Wed Mar 11, 2015 1:14 am

Return to Spire.XLS