Patch from rojotek from github-18 - Handle documents with a picture-only header
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1661908 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
d5065b1742
commit
b6a88f09c8
@ -92,7 +92,7 @@ public class XWPFDocument extends POIXMLDocument implements Document, IBody {
|
||||
/**
|
||||
* Keeps track on all id-values used in this document and included parts, like headers, footers, etc.
|
||||
*/
|
||||
private IdentifierManager drawingIdManager = new IdentifierManager(1L,4294967295L);
|
||||
private IdentifierManager drawingIdManager = new IdentifierManager(0L,4294967295L);
|
||||
protected List<XWPFFooter> footers = new ArrayList<XWPFFooter>();
|
||||
protected List<XWPFHeader> headers = new ArrayList<XWPFHeader>();
|
||||
protected List<XWPFComment> comments = new ArrayList<XWPFComment>();
|
||||
|
@ -337,6 +337,21 @@ public final class TestXWPFDocument extends TestCase {
|
||||
|
||||
doc.getPackage().revert();
|
||||
}
|
||||
public void testZeroLengthLibreOfficeDocumentWithWaterMarkHeader() throws IOException {
|
||||
XWPFDocument doc = XWPFTestDataSamples.openSampleDocument("zero-length.docx");
|
||||
POIXMLProperties properties = doc.getProperties();
|
||||
|
||||
assertNotNull(properties.getCoreProperties());
|
||||
|
||||
XWPFHeader headerArray = doc.getHeaderArray(0);
|
||||
assertEquals(1, headerArray.getAllPictures().size());
|
||||
assertEquals("image1.png", headerArray.pictures.get(0).getFileName());
|
||||
assertEquals("", headerArray.getText());
|
||||
|
||||
POIXMLProperties.ExtendedProperties extendedProperties = properties.getExtendedProperties();
|
||||
assertNotNull(extendedProperties);
|
||||
assertEquals(0, extendedProperties.getUnderlyingProperties().getCharacters());
|
||||
}
|
||||
|
||||
public void testSettings(){
|
||||
XWPFSettings settings = new XWPFSettings();
|
||||
|
BIN
test-data/document/zero-length.docx
Normal file
BIN
test-data/document/zero-length.docx
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user