DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUGĀ·
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=43693>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED ANDĀ·
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=43693

           Summary: setLandscape(true) has no effect on a loaded sheet.
           Product: POI
           Version: 3.0
          Platform: PC
        OS/Version: Windows 2000
            Status: NEW
          Severity: minor
          Priority: P3
         Component: HSSF
        AssignedTo: [email protected]
        ReportedBy: [EMAIL PROTECTED]


If you create a workbook from an existing xls file, the setLandscape method has
no effect.

If you create a new sheet instead of using the loaded one, the landscape option
works fine. (Commented line)

What i did exactly:

    public static void main(String[] args)
    {        
        try{
            // Read in a template xls document
            InputStream stream = new FileInputStream("c:/temp/template.xls");
           
            HSSFWorkbook wb = new HSSFWorkbook(stream);
            HSSFSheet sheet = wb.getSheetAt(0);
            // HSSFSheet sheet = wb.createSheet("New Sheet");
            
            HSSFPrintSetup setup = sheet.getPrintSetup();
            setup.setLandscape(true);
            
            // Create a row and put some cells in it. Rows are 0 based.
            HSSFRow row = sheet.createRow((short) 1);
            HSSFCell cell = row.createCell((short) 2);
            cell.setCellValue("XXXX");
    
            // Write the output to a file
            FileOutputStream fileOut = new 
FileOutputStream("c:/temp/workbook.xls");
            wb.write(fileOut);
            fileOut.close();
        }catch (Exception e) {
            e.printStackTrace();
        }
    }

The template.xls is simple a new created and saved xls document. (I would have
attached it, but did not know how.)

Used versions:

POI: poi-3.0.1-FINAL-20070705.jar
Java: jdk150_04

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

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to