We have a site license for Aspose.Excel. We are facing the following problem:
We have a varchar column to store Account numbers in SQL Server. A typical value in that column would be something like “090001231” ; where the leading 0 is of primary importance to identify the account. When we use ‘ImportDataTable’ on the excel class, it shows the accountnumber correctly but with an error-exclamation saying “Number stored as text”. I want to figure out a way so that this error does not apprear on the excel spreadsheet and the accountnumber is simply displayed as any other string.
Please let me know how I could get around this.
This is not a error. It’s just a warning. You can manually input “090001231” in a cell and format this cell as “Text”. MS Excel will also show this warning.
To remove it, you don’t have to make any change in Aspose.Excel or your program. You just have to change setting in your Excel.
Tools -> Options -> Error Checking
In that window, please uncheck “Number stored as text” option.
Thanks for the reply.
I tried doing that and the error disappears. However, if I enter that cell and just try to copy the number and then leave the cell, Excel converts the cell value from “09000134” —> 9000134 and left aligns it.
However if I select that row in Excel and then go to Format --> Cells --> Number and select “Text” then everything works fine.
Is it possible to specify exactly this through Aspose? The reason being is that this is a webapp with a number of excel reports being displayed. Hence, we would like to find a mechanism of doing this from our end rather than having the users modify the options in Excel.
You can try this:
If you use ImportDataTable method, please make sure the column type of "09000134" is string, not numeric.