Excel Interop 向 NumberFormat 添加斜杠
Excel Interop adds slashes to NumberFormat
我想通过 Excel Interop 设置整列的 NumberFormat:
column.NumberFormat = "# ##0";
但是,Excel添加了一个额外的斜杠(打开文档显示#\ ##0
)。
我发现了以下相关问题:Excel interop adding slashes in my number formatting string
但是,使用 column.NumberFormatLocal
,我 运行 出现异常:
Unhandled Exception: System.Runtime.InteropServices.COMException: Unable to set the NumberFormatLocal property of the Range class
有什么想法吗?
我可以改用 en-US 分隔符来解决问题:
column.NumberFormat = "#,##0"; // Note the comma
我不知道为什么。我的系统区域设置和应用程序的 CultureInfo
都是 de-AT
。我的系统千位分隔符也是 de-AT(即 space)。
出于某种原因 Excel Interop 仍然需要 en-US 分隔符。
我想通过 Excel Interop 设置整列的 NumberFormat:
column.NumberFormat = "# ##0";
但是,Excel添加了一个额外的斜杠(打开文档显示#\ ##0
)。
我发现了以下相关问题:Excel interop adding slashes in my number formatting string
但是,使用 column.NumberFormatLocal
,我 运行 出现异常:
Unhandled Exception: System.Runtime.InteropServices.COMException: Unable to set the NumberFormatLocal property of the Range class
有什么想法吗?
我可以改用 en-US 分隔符来解决问题:
column.NumberFormat = "#,##0"; // Note the comma
我不知道为什么。我的系统区域设置和应用程序的 CultureInfo
都是 de-AT
。我的系统千位分隔符也是 de-AT(即 space)。
出于某种原因 Excel Interop 仍然需要 en-US 分隔符。