Summary: | First comment not cloned after cloneSheet() | ||
---|---|---|---|
Product: | POI | Reporter: | Arimitsu <ishii> |
Component: | HSSF | Assignee: | POI Developers List <dev> |
Status: | RESOLVED FIXED | ||
Severity: | normal | ||
Priority: | P2 | ||
Version: | 3.8-FINAL | ||
Target Milestone: | --- | ||
Hardware: | PC | ||
OS: | Windows Vista | ||
Attachments: |
Test output file. res.xls
A file for test input |
This problem should be fixed in trunk. Please try with a nightly build - see download links on http://poi.apache.org/ or build yourself from SVN trunk, see http://poi.apache.org/subversion.html I get source files from SVN trunk,and Test on 20 august. Exception at [workbook.write(os);] java.lang.IllegalStateException: found multiple cell comments for cell $B$1 at org.apache.poi.hssf.usermodel.HSSFPatriarch.preSerialize(HSSFPatriarch.java:110) at org.apache.poi.hssf.usermodel.HSSFSheet.preSerialize(HSSFSheet.java:144) at org.apache.poi.hssf.usermodel.HSSFWorkbook.getBytes(HSSFWorkbook.java:1248) at org.apache.poi.hssf.usermodel.HSSFWorkbook.write(HSSFWorkbook.java:1167) According to the exception one of your sheets contains two or more comments for single cell. Please attach to this ticket source code and input file to reproduce this exception. Regards, Evgeniy Created attachment 29282 [details]
A file for test input
Test source code is the same as before. The Excel file(test.xls) used for the test attached at 2012-08-27 02:33. Regards, Hi Arimitsu Source file you've attached contains 2 comments for cell B1. However Excel correctly reads this file. Can you please explain me, how did you create such file using Excel or POI tools, so I will understand whether this file is corrupted and you should only create new file or consider this situation more detailed. Regards, Evgeniy Hi I should have checked again using other files. I'm sorry. I have forgotten how the old test file was created. I created test file newly and checked that a clone of the first comment was performed. Regards, |
Created attachment 28674 [details] Test output file. res.xls A cell's comment is not cloned. The comment is a comment processed by the 1st.(May be) public static void test() { try { InputStream is= new FileInputStream("test.xls"); Workbook workbook = WorkbookFactory.create(is); is.close(); Sheet sheet = workbook.cloneSheet(workbook.getSheetIndex("TEST1")); workbook.setSheetName(workbook.getSheetIndex(sheet), "TEST2"); FileOutputStream os = new FileOutputStream("res.xls"); workbook.write(os); os.close(); } catch (Exception e) { e.printStackTrace(); } } [res.xls : attachment] A sheet(TEST1) has 2 cells(A1,B1) that has comment. A cell(A1) on sheet(TEST2) has not comment. TEST2 cloned from TEST1.