poi-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject [Bug 56325] IndexOutOfBoundsException in removeSheetAt(0)
Date Fri, 24 Oct 2014 17:46:57 GMT
https://issues.apache.org/bugzilla/show_bug.cgi?id=56325

--- Comment #7 from Stanley Ni <zhixinni@gmail.com> ---
Created attachment 32143
  --> https://issues.apache.org/bugzilla/attachment.cgi?id=32143&action=edit
Here is a file can verify this problem

Here is the code will cause this problem
public class PoiBugTesting {

  public PoiBugTesting() {
    // TODO Auto-generated constructor stub
  }

  public static void main(String[] args) {
    try {
      HSSFWorkbook wBook = (HSSFWorkbook) WorkbookFactory.create(new
FileInputStream("C:\\Users\\xxx\\Desktop\\Bug Test Book.xls"));
      HSSFSheet sheet = wBook.cloneSheet(2);
      wBook.setSheetName(3, "Clone 1");
      sheet.setRepeatingRows(CellRangeAddress.valueOf("2:3"));
      wBook.setPrintArea(3, "$A$4:$C$10");

      sheet = wBook.cloneSheet(2);
      wBook.setSheetName(4, "Clone 2");
      sheet.setRepeatingRows(CellRangeAddress.valueOf("2:3"));
      wBook.setPrintArea(4, "$A$4:$C$10");

      wBook.removeSheetAt(2);

      FileOutputStream fOut = new
FileOutputStream("C:\\Users\\xxx\\Desktop\\test.xls");
      wBook.write(fOut);
      fOut.close();

    } catch (InvalidFormatException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    } catch (FileNotFoundException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    } catch (IOException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }

  }

}

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


Mime
View raw message