【问题标题】:SpreadsheetLight get an excel cell value beginning with aposthropeSpreadsheetLight 获取以撇号开头的 excel 单元格值
【发布时间】:2018-10-17 19:17:56
【问题描述】:

当我使用 SpreadsheetLight 读取 excel 单元格值时 - 我得到的单元格值没有前导撇号。当单元格值为“某事我只得到某事”时。我知道撇号对 excel 有特殊含义 - 但我真的需要那个字符! :)

如何检测单元格何时具有前导撇号?我使用 GetCellValueAsString(...) 函数来检索单元格值。

【问题讨论】:

    标签: excel cell spreadsheetlight


    【解决方案1】:

    前导撇号转到 QuotePrefix 属性的单元格样式数据。

    if (sl.HasCellValue(rowIndex, i + 1))
    {
        var style = sl.GetCellStyle(rowIndex, i + 1);
        var text= sl.GetCellValueAsString(rowIndex, i + 1);
        Row[i] = (style.QuotePrefix.HasValue && style.QuotePrefix.Value) ? "'" + text : text;
    }
    

    【讨论】:

      猜你喜欢
      • 2010-11-22
      • 2014-11-21
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-11-02
      • 2012-06-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多