Amjad,
I am facing some weird issue in this method.
I am using LightCellDataProvider for creating a excel file. Also I need to format same excel based on data size.
But any way autoFitColumn() doesn’t work in LightCellMode.
So I created a TWO dimensional array which maintains [SheetNumber][ColumnWidth].
Now suppose I have 2 sheets need to format. I will setColumnWidth for the first sheet after putting data in that sheet using startSheet() method.
setWidthSheet(sheetIndex-1)
So this will set width for the previous sheet which has all data. But not saved in the Sheet (Due to LightCellMode).
And then I start processing next sheet.
This works perfectly in XlsSaveOptions for saving XLS-2003 file.
But same code doesn’t work for OoxmlSaveOptions for saving XLSX-2007 file format.
Hi,
Could you give us complete runnable sample JAVA program to reproduce the issue for XLSX file format (which is working find for XLS file format - according to you) for setColumnWidth() method. We will check it soon.
Moreover, you should try to set column widths accordingly in the main program (on front) and not in the class that implements the “LightCellsDataProvider” interface.
Thank you.
IT’s not possible to upload entire project source code. You can create same scenario at your place.
Hi,
In light cells mode, when APIs of LightCellsDataProvider being called, part
of the data of the resultant file has been created and some other data need to
be gathered and created before creating cells data, such as the column settings
including width, styles, and so on.
So in light cells mode user cannot reset the
settings for columns in the implementation of LightCellsDataProvider. You have
to set column width before Workbook.save() call and outside of the
implementation of LightCellsDataProvider.
I am using same code in LightCellMode for generating xls (Office-2003) format. and this works fine. Issue is only for generating XLSX file.
Than how does this works perfectly. And if this is the case what's the use of LightCellMode. We can't even set width or Style or any basic formatting.
I am not expecting much features like AutoWidth column / rows or auto filtering.
Hi,
It is because the difference of XLS and XLSX file structure.
For XLS file, we have to generate one data block per sheet for cells data firstly and then combine them into the final file data. In this way we gather and create column settings after calling APIs in LightCellsDataProvider so the column settings user specified in the implementation of LightCellsDataProvider can take effect. However, because we have to cache those data blocks before saving the final file data, saving XLS file with light cells mode also need certain amount of more memory.
For XLSX file, we save all cells data directly to the final file data, so much less memory will be needed than saving XLS file. However for the XLSX file, data of column settings must occur before cells data, so data of column settings must be gathered and saved before calling APIs in LightCellsDataProvider, and all settings for column in the implementation of LightCellsDataProvider will take no effect.
Do you have any other way to setColumnWidth() based on data size of the for XLSX file in LigthCellMode ?
How can one set column size in the begining for a dynamic report ?
Hi,
Thanks for your posting and using Aspose.Cells for Java.
We will look into your issue and help/advise you about how to dynamically set the column width while working in LightCells mode.
We have logged your issue in our database with the issue id: CELLSJAVA-40358
Once, there is some update for you, we will let you know asap.