Set Row Height in Pixels with AutoFit option is enabled for worksheet while using Aspose.Cells for Java

Hello,
Row height in pixel cannot be set if autofitRows is enabled in worksheet.

Code Sample:

package test;

import com.aspose.cells.AutoFitterOptions;
import com.aspose.cells.Cell;
import com.aspose.cells.Cells;
import com.aspose.cells.Workbook;
import com.aspose.cells.Worksheet;

public class TestRowSqueeze{

public static void main(String[] args)
{
Workbook workbook;
try {
workbook = new Workbook(“C:\Test.xlsx”);
Worksheet worksheet = workbook.getWorksheets().get(1);
Cell cell = worksheet.getCells().get(“C3”);
cell.putValue(“Slide Title”);

Cells cells = worksheet.getCells();

//Setting the Row Height in Pixel
cells.setRowHeightPixel(10, 1);
AutoFitterOptions autoOptions = new AutoFitterOptions();
autoOptions.setAutoFitMergedCells(true);

try {
worksheet.autoFitRows(autoOptions);
worksheet.autoFitColumns(autoOptions);
} catch (Exception e) {

e.printStackTrace();
}

cells.convertStringToNumericValue();
System.out.println(“cell.getValue” + cell.getValue());
workbook.save(“C:\Test.xlsx”);
} catch (Exception e2) {

e2.printStackTrace();
}

}
}

Hi,


Sure, the setting of row heights would be useless when you perform Auto-fit rows operation. This is expected behavior. When you perform Auto-fit rows operation, then the individual setting of your row height would be ignored, this behavior is same as MS Excel and it should be.

If you have different opinion and MS Excel behaves differently than what Aspose.Cells does regarding Auto-fit rows operation, give us your input file, the output file by Aspose.Cells and your expected file that you may create when performing the Auto-fit operation in MS Excel manually. We will check it soon.

Thank you.