Free Support Forum - aspose.com

Get Column Width using LightCellsDataHandler

Hello, how do I obtain column widths using the LightCellsDataHandler? I’ve tried accessing in the ProcessCell method, and at the sheet level but it always returns a default value?

Thanks

@jsnyder69d92,

Thanks for your query.

I think using LightCells API may not be right approach for detecting and reading formattings (e.g column widths) from the spreadsheet. For your information, while reading Excel file in light weight mode, the component parses each cell and provides its cell value only in sequence (cell by cell). But mind you, after a cell is processed for its value, it is discarded and the cell does not exist any more. This way, lots of memory is saved when importing large Excel data set which is the main purpose of LightCells APIs. It would be better if you could write your code for obtaining columns’ width outside of the implementation of LightCells data handler.

Anyways, We will further check if we can do something or read column widths in light weight mode. If we find some better way or something else, we will provide more details here.

@jsnyder69d92,

We evaluated your issue further. We have tested LightCellsDataHandler with a simple template file but could not find the issue. When getting the column width in StartSheet, StartCell and ProcessCell, we confirmed we can always get the correct column width. In short, Light Cells API can be used to obtain the columns’ width with simple template files. Please send us your template file and simple console application (runnable) to reproduce the issue, we will check it soon.