Hi Aspose
I’m unable to use the method sheet.getPageSetup().setFitToPagesWide(1) with the expected result. Calling this method causes the page to also fit all rows on the page. I only expected the columns to fit. Excel displays the setting “Fit Sheet on One Page” when calling the method. I believe the correct behavior would have been “Fit All Columns on One Page”.
The following code will generate a xls file with the described problem, and will fit all 200 rows in one page.
Workbook wb = new Workbook();
wb.getWorksheets().add();
Worksheet sheet = wb.getWorksheets().get(0);
Cells cells = sheet.getCells();
for (int i = 0; i < 200; i++) {
Cell cell = cells.get(i, 0);
cell.setValue(i);
}
sheet.getPageSetup().setFitToPagesWide(1); //fits one page wide
String filename = "C:\\temp\\test.xls";
new File(filename).getParentFile().mkdirs();
wb.save(filename, SaveFormat.EXCEL_97_TO_2003);
Am I doing something wrong, or is this a bug?
Kind Regards
Kenneth VIndum