0

When I read an excel cell value using SpreadsheetLight - I get the cell value without the leading apostrophe. 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! :)

How to detect when a cell has a leading apostrophe? I use the GetCellValueAsString(...) function to retrieve cell value.

Zoltan Hernyak
  • 989
  • 1
  • 14
  • 35

1 Answers1

0

The leading apostrophe went to the cell style data to the QuotePrefix property.

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;
}
Zoltan Hernyak
  • 989
  • 1
  • 14
  • 35