We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Error while reading cells with warning

I have an Excel file with numbers and text. All the cells in this Excel are formatted as text.(Format cell à Number (tab)à Text). In one cell the data is “$123.45” without the quotes. After doing this excel will show a green warning which says that “the number in this cell is formatted as text or preceded by an apostrophe”. We need to keep the cells as text and do not want to convert it to number or a currency.

<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

I then saved the excel and used aspose.cells to read the data from these cells by spreadsheet.Row[2].Cell[5].Text. This will return incorrect values than what we see in the excel sheet. That is instead of “$123.45” I get “123.45” and instead of “(0.044)” I get “-0.044”. Why am I not getting the value which I have written as it is? When I open the next time the same document in excel, I am getting the same data which I have written along with warning, but why does aspose.cell not return the same value. What should I be doing to get this value?

I am using Aspose.Cells version 4.4.3.19 and it is a licensed version.

Hi,

Well, I don't find the problem you have mentioned.

Following is my testing code, I read the correct values in the cells.:

Workbook workbook = new Workbook();
workbook.Open("d:\\test\\Sample Excel.xls");
Worksheet sheet = workbook.Worksheets[0];
Cells cells = sheet.Cells;
MessageBox.Show(cells["C3"].StringValue);
MessageBox.Show(cells["C9"].StringValue);
MessageBox.Show(cells["C11"].StringValue);

workbook.Save("d:\\test\\out_Sample Excel.xls");

I am using the lastet version 4.5.0.0, could you try it.

Thank you.