gpt4 book ai didi

C# 任务、System.Threading.Thread.CurrentThread.CurrentCulture 和 Microsoft.Office.Interop.Excel

转载 作者:行者123 更新时间:2023-11-30 18:41:03 24 4
gpt4 key购买 nike

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

这里是一些代码:

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

}

输出:

fr-fr

fr-fr

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

最佳答案

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

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

关于C# 任务、System.Threading.Thread.CurrentThread.CurrentCulture 和 Microsoft.Office.Interop.Excel,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7393526/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com