https://bz.apache.org/bugzilla/show_bug.cgi?id=58850
Bug ID: 58850
Summary: XWPFTable adds border while just opening and saving
Product: POI
Version: unspecified
Hardware: PC
OS: Windows NT
Status: NEW
Severity: normal
Priority: P2
Component: XWPF
Assignee: [email protected]
Reporter: [email protected]
I just opened and saved a docx file like this:
File infile = new File("test.docx");
XWPFDocument xdoc = null;
FileInputStream fis = new FileInputStream(infile);
xdoc = new XWPFDocument(OPCPackage.open(fis));
FileOutputStream outstr = new FileOutputStream(new File("bug.docx"));
xdoc.write(outstr);
outstr.close();
This document contained a table, which was set to borderless. After opening the
exported bug.docx, i noticed, that the above code added a border to the table.
I looked into the document.xml, which contained the following:
test.docx
<w:tbl>
<w:tblPr>
<w:tblStyle w:val="Basic"/>
<w:tblpPr w:horzAnchor="page" w:leftFromText="142"
w:rightFromText="142" w:tblpX="1702" w:tblpY="937" w:vertAnchor="page"/>
<w:tblW w:type="auto" w:w="0"/>
<w:tblLayout w:type="fixed"/>
<w:tblLook w:firstColumn="1" w:firstRow="1" w:lastColumn="0"
w:lastRow="0" w:noHBand="0" w:noVBand="1" w:val="04A0"/>
</w:tblPr>
<w:tblGrid>
<w:gridCol w:w="6804"/>
</w:tblGrid>
...
</w:tbl>
There were some standard values added:
bug.docx
<w:tbl>
<w:tblPr>
<w:tblStyle w:val="Basic"/>
<w:tblpPr w:horzAnchor="page" w:leftFromText="142"
w:rightFromText="142" w:tblpX="1702" w:tblpY="937" w:vertAnchor="page"/>
<w:tblW w:type="auto" w:w="0"/>
<w:tblLayout w:type="fixed"/>
<w:tblLook w:firstColumn="1" w:firstRow="1" w:lastColumn="0"
w:lastRow="0" w:noHBand="0" w:noVBand="1" w:val="04A0"/>
</w:tblPr>
<w:tblPr>
<w:tblW w:type="auto" w:w="0"/>
<w:tblBorders>
<w:top w:val="single"/>
<w:left w:val="single"/>
<w:bottom w:val="single"/>
<w:right w:val="single"/>
<w:insideH w:val="single"/>
<w:insideV w:val="single"/>
</w:tblBorders>
</w:tblPr>
<w:tblGrid>
<w:gridCol w:w="6804"/>
</w:tblGrid>
...
</w:tbl>
This problem is caused by the createEmptyTable method inside the XWPFTable. I
think this method shouldnt be called in this case.
--
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]