C#Tasks,System.Threading.Thread.CurrentThread.CurrentCulture和Microsoft.Office.Interop.Excel

时间:2023-01-07 02:21:04

I execute code in Tasks in order to generate excel files. But cells format are still in en-US format. Do Tasks get the CurrentCulture parameter of the Current Thread ?

我在Tasks中执行代码以生成excel文件。但是格式格式仍然是en-US格式。 Do Tasks获取当前线程的CurrentCulture参数?

Here some code :

这里有一些代码:

        Parallel.ForEach(_blablalist, blabla =>
        {
            Console.WriteLine(System.Threading.Thread.CurrentThread.CurrentCulture);
            Console.WriteLine(System.Threading.Thread.CurrentThread.CurrentUICulture);
            Dowork(blabla);

        }

Output :

fr-FR

fr-FR

This is what I want but the excel keep to be in en-US format. Maybe Tasks have others parameters :/

这就是我想要的,但excel一直是en-US格式。也许任务有其他参数:/

1 个解决方案

#1


0  

http://msdn.microsoft.com/en-us/library/system.globalization.cultureinfo.aspx

Looks like that CultureInfo works only for unmanaged code :(

看起来CultureInfo仅适用于非托管代码:(

#1


0  

http://msdn.microsoft.com/en-us/library/system.globalization.cultureinfo.aspx

Looks like that CultureInfo works only for unmanaged code :(

看起来CultureInfo仅适用于非托管代码:(