将双重值写入与培养无关的细胞

时间:2016-11-08 11:17:35

标签: c# excel excel-interop

我使用Excel COM Interop在电子表格中设置单元格的值:

public void SetValue(double value, string sheetName, int cellRow, int cellColumn)
{
    var cell = GetCell(sheetName, cellRow, cellColumn);
    cell.Value2 = value;
}

GetCell()是一个返回Range对象的方法。

根据系统文化设置,此方法无法正常工作:

这些值:

enter image description here

如果Excel的文化是德语,则

编写如下:

enter image description here

我的问题:

  1. 为什么Excel没有正确处理格式? Isn' t Value2" typesafe"?
  2. 如何正确设置双重值而不依赖于系统文化?

0 个答案:

没有答案