protected void read(POIXMLFactory factory, Map<PackagePart, POIXMLDocumentPart> context) throws OpenXML4JException {
PackagePart pp = getPackagePart();
- if (pp.getContentType().equals(XWPFRelation.TEMPLATE.getContentType())) {
+ if (pp.getContentType().equals(XWPFRelation.GLOSSARY_DOCUMENT.getContentType())) {
logger.log(POILogger.WARN,
"POI does not currently support template.main+xml (glossary) parts. " +
"Skipping this part for now.");
//once we add processing for this, we can change this to contains
assertNotContained(txt, "table rows");
}
+
+ public void testPartsInTemplate() throws IOException {
+ XWPFDocument doc = XWPFTestDataSamples.openSampleDocument("60316b.dotx");
+ XWPFWordExtractor extractor = new XWPFWordExtractor(doc);
+ String txt = extractor.getText();
+ assertContains(txt, "header 2");
+ assertContains(txt, "footer 1");
+ }
}