c# - Load an Excel cell value with a leading apostrophe -
i want able load exact text within excel cell using spreadsheet gear. because want leading apostrophe.
for example cell has text; 'test' test. spreadsheet gear strips away leading '.
spreadsheetgear.iworkbook workbook = null; workbook = spreadsheetgear.factory.getworkbookset(workbooks.open(excelfilename); irange usedrange = workbook.worksheets[0].usedrange; text = workbook.worksheets[0].cells[row, 0].value string;
is limitation of loading data excel? or there different way load contents of excel cell using spreadsheet gear?
the value of irange.value/text not include leading apostrophe since special case in spreadsheetgear/excel indicates inputted contents should force-treated text.
one way string value leading apostrophe check irange.prefixcharacter. example:
string text = cell.value.tostring(); if (cell.prefixcharacter == '\'') text = "'" + text;
Comments
Post a Comment