How to set type for a cell in excel file?

I have a mini project, that read many excel files. These excel files have 2 collumns, one is id and another is phone number but in 2nd col, some rows have type numeric, some rows have type String . So when I use Apose Cell to read it, it always go to exception.

When I use POI apache, I set type for cell to String then get string value of this and this OK, but POI don’t work well with huge excel file. So I try Apose, but I cant do smiliar POI.

Anyone help me to do this???

Thanks

Hi Tai,


Thank you for contacting Aspose support.

Please provide more details/code snippet along with sample spreadsheet to elaborate your requirement of reading cell values. This will help us understand your scenario better. Anyway, if you are interested to format the given column to one data type, please check the following articles.

babar.raza:
Hi Tai,

Thank you for contacting Aspose support.

Please provide more details/code snippet along with sample spreadsheet to elaborate your requirement of reading cell values. This will help us understand your scenario better. Anyway, if you are interested to format the given column to one data type, please check the following articles.

I found it this function getDisplayStringValue() in com.aspose.cells.Cell and now my code runs smoothly.
No need settype again, I think It could be a big advantage but I would test more :)

Thanks

Hi Tai,


Thank you for writing back. Please note, the Cell.getDisplayStringValue method will return the cell value as it is displayed in Excel application. The cell could have number/date formatting applied so the said method will return you the text with formatting.

Please feel free to contact us back in case you need our further assistance with Aspose APIs.