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.

Thu Nov 09, 2017 8:43 am

Hi Vincent,

Please feel free to contact us if you have any other question.

Sincerely,
Betsy
E-iceblue support team
User avatar

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

Tue Nov 21, 2017 9:42 am

Hi,

We need to set the NumberFormat with an international string mask.
We also need to set the Value2 with InvariantCulture (independently of NumberFormat).

Have you a solution to make this work in any culture of Excel ?

Best Regards,

Vincent

VincentB
 
Posts: 120
Joined: Thu Sep 15, 2016 9:44 am

Tue Nov 21, 2017 10:13 am

Hello VincentB,

As Betsy said before, you could use the InvariantCulture and there's no need to set the number format anymore. The result format will depend on the region and culture.
Besides, I am a little confused about your requirement. Could you describe your need in detail and give us an example?

Sincerely,
Jane
E-iceblue support team
User avatar

Jane.Bai
 
Posts: 1156
Joined: Tue Nov 29, 2016 1:47 am

Thu Nov 23, 2017 1:06 pm

Hello,

In the code bellow, we can't remove any line, because the NumberFormat is defined by our application's user (in international).
In French Excel, the international date NumberFormat "m/d/yyyy" (set by user) is considered like Custom format.

Code: Select all
var workbook = new Workbook();
var worksheet = workbook.Worksheets.First();

worksheet.Range["B2"].Value2 = new DateTime(2017, 01, 30);
worksheet.Range["B2"].NumberFormat = "m/d/yyyy";

workbook.SaveToFile(Chemin + "Sample - Out.xlsx", ExcelVersion.Version2016);


With the same code, we need in French Excel the NumberFormat : "jj/mm/aaaa", and we need in English Excel the NumberFormat : "m/d/yyyy".

Do you need more informations ?


Regards,

Vincent

VincentB
 
Posts: 120
Joined: Thu Sep 15, 2016 9:44 am

Fri Nov 24, 2017 1:44 am

Hello VincentB,

Thanks for your details.
In my understanding, you want us to automatically alter the date format interiorly according to your culture without any change to your code(still the English number format "m/d/yyyy"), right? If so, sorry I'm afraid it is not impossible to do that because this operation will influence other functionalities.

Sincerely,
Jane
E-iceblue support team
User avatar

Jane.Bai
 
Posts: 1156
Joined: Tue Nov 29, 2016 1:47 am

Wed Nov 29, 2017 9:42 am

Hello,

Ok, i'll try to find an other way.
I'll come back to you if i have others questions

Thanks

VincentB
 
Posts: 120
Joined: Thu Sep 15, 2016 9:44 am

Wed Nov 29, 2017 9:47 am

Hello,

Thanks for your feedback.
Just feel free to contact us if you need any assistance.

Sincerely,
Jane
E-iceblue support team
User avatar

Jane.Bai
 
Posts: 1156
Joined: Tue Nov 29, 2016 1:47 am

Return to Spire.XLS