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=43088>. 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=43088 Summary: Excel file can't be loaded if comments exceed a size of 4111 characters Product: POI Version: 3.0 Platform: PC OS/Version: Windows XP Status: NEW Severity: normal Priority: P2 Component: HSSF AssignedTo: [email protected] ReportedBy: [EMAIL PROTECTED] Hi, this bug seems to be similar to bug 42920 (Excel Comments). When attaching comments to a cell with poi-3.0.1-FINAL-20070705.jar and the comments exceed a size of 4111 characters, the file can't be loaded by Excel any more (I tried Excel 2003 and Excel 2007). There are no problems in saving the file. However, when opening the file with Excel, I get the error message "Excel found unreadable content in foo.xls". Attached a small test case which reproduces the problem. The created excel file works fine if the comment size is up to 4111 characters. But with a comment size of 4112 characters, the excel file can't be loaded any more. import java.io.FileOutputStream; import org.apache.poi.hssf.usermodel.HSSFCell; import org.apache.poi.hssf.usermodel.HSSFClientAnchor; import org.apache.poi.hssf.usermodel.HSSFComment; import org.apache.poi.hssf.usermodel.HSSFPatriarch; import org.apache.poi.hssf.usermodel.HSSFRichTextString; import org.apache.poi.hssf.usermodel.HSSFRow; import org.apache.poi.hssf.usermodel.HSSFSheet; import org.apache.poi.hssf.usermodel.HSSFWorkbook; public class Comments { public static void main(String args[]) throws Exception { HSSFWorkbook workBook = new HSSFWorkbook(); HSSFSheet sheet = workBook.createSheet(); HSSFPatriarch patriarch = sheet.createDrawingPatriarch(); HSSFRow row = sheet.createRow(0); HSSFCell cell = row.createCell((short)0); // works with 4111 // broken with 4112 int size = 4112; StringBuffer toolTip = new StringBuffer(size); for (int i = 0; i < size; i++) { toolTip.append("."); } HSSFClientAnchor anchor = new HSSFClientAnchor(0, 0, 0, 0, (short)0, 0, (short)1, 1); HSSFComment comment = patriarch.createComment(anchor); comment.setString(new HSSFRichTextString(toolTip.toString())); cell.setCellComment(comment); workBook.write(new FileOutputStream("foo.xls")); } } Regards, Jan -- 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]
