Thread Culture issue with addinexpress

Add-in Express™ Support Service
That's what is more important than anything else

Thread Culture issue with addinexpress
 
Ashim Mishra




Posts: 48
Joined: 2016-03-01
Hi Team,

We have our excel addin where in AddinModule_AddinStartupComplete we set the cultureInfo as

CultureInfo enUsCulture = new CultureInfo("en-US");


This is as per the recommendation of Microsoft.

Recently we started getting issue from some non US client about changing their date format, to US format. Their in-house addin have been breaking because of the format issue.

What do you guys think about this issue, what are your suggestion about setting the ThreadCulture. If we remove it what kind of problem/issues we may get ?
Posted 18 Nov, 2020 05:36:24 Top
Andrei Smolin


Add-in Express team


Posts: 17500
Joined: 2006-05-11
Hello Ashim,

You should set the CultureInfo before you invoke the Excel object model. After the call you should restore it.
Find an example in https://www.add-in-express.com/creating-addins-blog/2009/02/13/old-format-invalid-type-library/. That page describes an exception that you may get if you don't do this.

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 18 Nov, 2020 06:03:28 Top
Ashim Mishra




Posts: 48
Joined: 2016-03-01
Hi Andrei,


So are you suggesting to not set the culture info in AddinModule_AddinStartupComplete instead assign the culture info at the time of using the excel object model ?
Posted 18 Nov, 2020 08:28:12 Top
Andrei Smolin


Add-in Express team


Posts: 17500
Joined: 2006-05-11
Hello Ashim,

Yes, in every method/property that uses the Excel object model. I also suggest that you reread that article by Microsoft: I believe they recommend doing the very same thing.

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 18 Nov, 2020 08:48:58 Top