https://bz.apache.org/bugzilla/show_bug.cgi?id=57929

            Bug ID: 57929
           Summary: Why HSSFWorkbook.removePrintArea(index) invalid?
           Product: POI
           Version: 3.12-FINAL
          Hardware: PC
            Status: NEW
          Severity: major
          Priority: P2
         Component: HSSF
          Assignee: [email protected]
          Reporter: [email protected]

Hi:
    I have a question, Why HSSFWorkbook.removePrintArea(index) invalid?  I use
poi version 3.12.

Code:

 public static void main( String[] args )
    {

        try {
            String targetFile = "C:\\Users\\syf\\Desktop\\test_1_oo.xls";
            Workbook wb = null;
            FileInputStream fis = new FileInputStream(targetFile);
            wb = new HSSFWorkbook(fis);
            System.out.println(wb.getPrintArea(0));
            System.out.println(wb.getPrintArea(1));

            wb.removePrintArea(0);
            wb.setPrintArea(1, 0, 0, 0, 0);

            System.out.println("-------------------");
            System.out.println(wb.getPrintArea(0));
            System.out.println(wb.getPrintArea(1));
            fis.close();
            FileOutputStream fileOut = new FileOutputStream(targetFile);
            wb.write(fileOut);
            fileOut.flush();
            fileOut.close();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

First Run Result:
    Sheet1!$A$1:$C$6  // this value is my setting
    Sheet2!$B$1:$C$5  // this value is my setting
    -------------------
    null                           // after remove print area , the value is
this
    Sheet2!$A$1:$A$1  // after remove print area , the value is this

Second Run Result:
    Sheet1!$A$1:$C$6  // this value should 'null' but ...
    Sheet2!$A$1:$A$1  
    -------------------
    null
    Sheet2!$A$1:$A$1

                                                                               
                                       Thanks a lot !

-- 
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