We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Auto-resize the row to fit long length text so that entire text is visible

Hi,

I am using Aspose.Cell for Java and its version is 2.4.0.1.
I am trying to get the auto-resize the row if the text is
too long to be visible in the cell but unable to do so.
While I was searching in the community I got something like


Workbook wb = new Workbook();
//Note when you create a new workbook, a default worksheet
//"Sheet1" is added (by default) to the workbook.
//Access the first worksheet "Sheet1" in the book.
Worksheet sheet = wb.getWorksheets().get(0);
sheet.setName("Sample");
//sheet.autoFitRow(0);
Cells cells = sheet.getCells();
cells.setStandardWidthPixels(10);
cells.merge(0, 0, 1, 5);
Cell cell = cells.get(0, 0);
cell.putValue("Check Row Re-sizing");

Style style = cell.getStyle();
style.setTextWrapped(true);
cell.setStyle(style);

AutoFitterOptions autoOptions = new AutoFitterOptions();
autoOptions.setAutoFitMergedCells(true);
try {
sheet.autoFitRows(autoOptions);
sheet.autoFitColumns(autoOptions);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}


But the problem is I don't have AutoFitterOptions in my version that I'm using. Could you please suggest me is there a to achieve this in my code.

Thanks,
Javeed

Hi,

Thanks for your posting and using Aspose.Cells for Java.

We are afraid, you will have to use the latest version: Aspose.Cells
for Java v7.5.0.1
Your version is quite old and this feature is not available in the older version, please download and try the latest version to run this code.