[英]SpreadsheetLight get an excel cell value beginning with aposthrope
When I read an excel cell value using SpreadsheetLight - I get the cell value without the leading apostrophe. 当我使用SpreadsheetLight读取一个excel单元格值时-得到的单元格值没有前导撇号。 When the cell value is 'Something I only get Something.
当单元格值为“某物时,我只会得到某物。 I understand that the apostrophe has a special meaning for excel - but I really need that char!
我知道撇号对excel具有特殊含义-但我确实需要该字符! :)
:)
How to detect when a cell has a leading apostrophe? 如何检测细胞何时具有前导撇号? I use the GetCellValueAsString(...) function to retrieve cell value.
我使用GetCellValueAsString(...)函数检索单元格值。
The leading apostrophe went to the cell style data to the QuotePrefix property. 前导撇号将单元格样式数据转到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;
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.