https://bz.apache.org/bugzilla/show_bug.cgi?id=65292
Bug ID: 65292
Summary: createRow() leads to corrupted word file
Product: POI
Version: 5.0.0-FINAL
Hardware: PC
Status: NEW
Severity: normal
Priority: P2
Component: XWPF
Assignee: [email protected]
Reporter: [email protected]
Target Milestone: ---
Created attachment 37849
--> https://bz.apache.org/bugzilla/attachment.cgi?id=37849&action=edit
Test word file
Hello,
we have a docx file with a table in it.
If we add a new row via createRow() and save the document, it gets corrupted.
MS Word says "Word found unreadable cotent in ... Do you want to recover the
contents of this document? If you trust the source of this document, click yes"
The code to reproduce this is quite small:
public static void main(String[] args) throws Exception
{
File templateFile = new File("c\\test.docx");
XWPFDocument xwpfDocument = null;
try (InputStream input = new FileInputStream(templateFile))
{
xwpfDocument = new XWPFDocument(input);
}
XWPFTable table = xwpfDocument.getTableArray(0);
table.createRow();
try (FileOutputStream output = new
FileOutputStream("c:\\test_out.docx"))
{
xwpfDocument.write(output);
}
xwpfDocument.close();
}
Without the line table.createRow() everything works well. Adding a row to the
table renders the file corrupt when saving.
Could you check and verify the problem with the current version 5.0.0 ?
Thanks in advance!
--
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]