https://issues.apache.org/bugzilla/show_bug.cgi?id=49253

           Summary: setRepeatingRowsAndColumns sets print orientation from
                    landscape to portrait
           Product: POI
           Version: 3.6
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: normal
          Priority: P2
         Component: XSSF
        AssignedTo: [email protected]
        ReportedBy: [email protected]


I have an XSSFWorkbook in which I set the page/print orientation to landscape
and set one row/some columns to repeat on each page. After setting the
repeating rows and columns, Excel displays orientation portrait instead of the
desired landscape.

Test code:

        Workbook workbook = new XSSFWorkbook();
        Sheet sheet = workbook.createSheet();

        Row row = sheet.createRow(0);
        Cell cell = row.createCell(0);
        cell.setCellValue("1");
        cell = row.createCell(1);
        cell.setCellValue("2");
        cell = row.createCell(2);

        PrintSetup printSetup = sheet.getPrintSetup();
        printSetup.setLandscape(true);

        workbook.setRepeatingRowsAndColumns(0, 0, 1, 0, 0);
        // printSetup.setValidSettings(true);

        workbook.write(new FileOutputStream(new File("test-landscape.xlsx")));

Now open the file in Excel and check the page settings. 
It displays "portrait". That's wrong!

Now, if you comment in the line: 
printSetup.setValidSettings(true);
and run the test again, the resulting file shows "landscape" again. Correct.

Looking into the sources, I found that in the last statement of method
setRepeatingRowsAndColumns, printSetup.setValidSettings(false); is called,
which led me to the described workaround.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to