setColumnWidthPixel and setRowHeightPixel have different behaviors

Hi,

I’m using Aspose.Cells for Java v17.7 and I want to know why when I do this:

sheet.getCells().setColumnWidthPixel(0, Integer.MAX_VALUE);

the Column Width is set to the maximum allowed by Excel (1789px), but when I do this:

sheet.getCells().setRowHeightPixel(0, Integer.MAX_VALUE);

a CellsException is thrown “Row height must be between 0 and 409.”.
This two function should have the same behavior and the “setRowHeightPixel” is called with a value > 409 the height should be set to 409.

Best regards,
Hugo Freixo

@Hugo_Freixo,

Thanks for providing details.

After an initial test, I observed the issue as you mentioned. I found that Cells.setColumnWidthPixel and Cells.setRowHeightPixel have different behaviors. Ideally either both methods should show exceptions accordingly or both should work accordingly:
e.g
Sample code:

//Create a workbook 
Workbook workbook = new Workbook(); 
//Access first sheet 
Worksheet worksheet = workbook.getWorksheets().get(0); 

worksheet.getCells().setColumnWidthPixel(0, Integer.MAX_VALUE); 

worksheet.getCells().setRowHeightPixel(0, Integer.MAX_VALUE);//Exception 

//Save the file 
workbook.save("out1.xlsx"); 

I have logged a ticket with an id “CELLSJAVA-42435” for your issue. We will look into it soon.

Once we have an update on it, we will let you know here.

@Hugo_Freixo

Thanks for using Aspose APIs.

This is to inform you that we have fixed your issue CELLSJAVA-42435 now. We will soon provide the fix after performing QA and including other enhancements and fixes.

@andreagasparin

Thanks for using Aspose APIs.

Please download and try the following fix and let us know your feedback.

An exception will be thrown too when calling worksheet.getCells().setColumnWidthPixel(0, Integer.MAX_VALUE);

Hi,
I was expecting it to not throw an Exception. That way I have to handle the max Height and max Width, instead of letting Aspose.Cell handle it.

@Hugo_Freixo,

Yes, you got to handle it by yourself as we think it is logical and fair to throw exception accordingly.

The issues you have found earlier (filed as CELLSJAVA-42435) have been fixed in this Aspose.Cells for Java 17.11 update.

Please also check the following document/blog for your reference:

The issues you have found earlier (filed as ) have been fixed in this update. This message was posted using BugNotificationTool from Downloads module by MuzammilKhan