Created attachment 27508 [details] Opening and re-writing this file corrupts the output This code run against the attached document results in a corrupt word document that crashes MSWord 2003 and 2007 refuses to open. private void start() throws FileNotFoundException, IOException { POIFSFileSystem fsfilesystem = null; HWPFDocument hwpfdoc = null; InputStream resourceAsStream = getClass().getResourceAsStream("/com/blackbox/admin/templates/rma.doc"); try { fsfilesystem = new POIFSFileSystem(resourceAsStream ); hwpfdoc = new HWPFDocument(fsfilesystem); FileOutputStream fos = new FileOutputStream(new File("C:\\temp\\newTemplate.doc")); hwpfdoc.write(fos); fos.flush(); fos.close(); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } System.out.println("Opened"); }
Please, check latest code from trunk and attachment with saved document. It is passed Microsoft BFFValidator. Several bugs were fixed: - summary properties handling - extended FIB handling - lists handling
Created attachment 27667 [details] Result doc (correct one)
Created attachment 27668 [details] Validation result
Created attachment 28099 [details] Opening and re-writing this file corrupts the output Table cells seems to be problematic. Tested : Merging any cells (using WORD 2007) from the input document before re-writing it makes the output clean. Removing the table produces a clean output too
Reopening for 3.8-beta5 : See previous comment
This bug still exists in Version 3.10 final. The following Situation occured: My Word Document contains a table and I want to replace some text in a cell. This works fine and I can open the file with Word 2010, but not with Word 2003 (It is a doc file). There are three cases after replacing the text: 1. same length of the text: no problem, it is possible to open the file in Word 2003 2. old one is longer than replacement: open and repair is possible with Word 2003 3. old one is shorter than replacement: Word 2003 crashes It is possible to open all documents with Word 2010. Another test was to replace a text that is contained in an enumeration, but not in a table and it has got the same behavior.