【问题标题】:C# ExcelPackage set cell type as numberC# ExcelPackage 将单元格类型设置为数字
【发布时间】:2013-10-16 12:25:48
【问题描述】:

我正在使用 c# .net。 我正在从头开始创建一个新的 excel 文件。 一些单元格包含文本,一些单元格包含数字。 如何使用 C# ExcelPackage 将单元格的类型设置为数字?

【问题讨论】:

    标签: c# excelpackage


    【解决方案1】:

    这应该可行:

    // Get the entire column you want (in this example column A)
    var range = someWorkSheet.get_Range("A:A");  
    // Set the format to numbers
    range.NumberFormat = "0";
    

    (如果你想将其设置为文本,那么range.NumberFormat = "@";

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-04-07
      • 1970-01-01
      • 1970-01-01
      • 2012-03-03
      • 1970-01-01
      • 2018-03-07
      • 1970-01-01
      • 2019-11-12
      相关资源
      最近更新 更多