Auto Fit Columns not working

Hi,

Using a purchased version of Aspose.Cells. I tried all flavours of autofit columns method.
Non of them is working in Aspose.

Can you please suggest a solution

Thanks

Shrikant

Hi,


It looks like you are using JAVA version of Aspose.Cells. Please try our latest version/fix: Aspose.Cells for Java v7.3.1.3
Please create a sample program with your template files, post it here to reproduce the issue on our end. We will check your issue soon.

Thank you.

I am formatting the sheet by using this code. Before starting LightCellDataProvider to process next sheet (second sheet) ,it will format the first sheet. since first sheet has data

public boolean startSheet(int sheetIndex) {
if (sheetIndex >= 1 && sheetIndex <= sheetCount) {
if (sheetIndex >= 2) {
formatReportSheet(workbook);
}
rowIndex = -1;
colIndex = -1;

return true;
}
return false;
}

Data in the column - JEFFREY R HAINES TTEE U/A DTD 02/04/1997 JEFFREY R HAINES SEP PROP TR (TACTICAL A/C)

I use below code to autoFitColumn. But always return incorrect width .so workSheet.getCells().getColumnWidth will always return 8.428571428571429. because autoFitColumn method always fails.

Iches=0.6666666666666666
pixel=64
width=8.428571428571429

workSheet.autoFitColumn(columnIndex, rowStart, rowEnd);
if (workSheet.getCells().getColumnWidth(columnIndex) > 70) {
workSheet.getCells().setColumnWidth(columnIndex, 70);
} else if (workSheet.getCells().getColumnWidth(columnIndex) < 15) {
workSheet.getCells().setColumnWidth(columnIndex, 15);
}

Hi,

I think you are mixing the things i.e. using auto-fit operation in LightCells mode, which is not possible.
For your information, the Auto-fit operation for rows/columns is impossible in LightCells mode because there is no cells data kept in cells model when using LightCells APIs.

And, if you need the required column width by cell's content in normal mode, we think maybe you can use the Cell.GetWidthOfValue() after filling value and applying styles. However, this method is not so accurate and may cause bad performance for CPU for large dataset of cells.

Thanks for your understanding!

Hi,

In order to autofit columns or rows, we make use of font information.

So, please make sure, you have access to the fonts being used by cells in your worksheets.

Please also set the font directory CellsHelper.setFontDir() and make sure all the fonts are present (installed) on your computer.

Try running your application with full access rights.

If you are using Linux, then see do you get the same results on Windows Environment. In such case, copy all needed fonts to your Linux machine.