import org.apache.poi.xddf.usermodel.chart.XDDFChart;
import org.apache.poi.xssf.usermodel.XSSFRelation;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
+import org.apache.poi.xwpf.usermodel.XWPFRelation;
/**
* Represents an entry of a OOXML package.
*/
protected void read(POIXMLFactory factory, Map<PackagePart, POIXMLDocumentPart> context) throws OpenXML4JException {
PackagePart pp = getPackagePart();
+
+ if (pp.getContentType().equals(XWPFRelation.TEMPLATE.getContentType())) {
+ logger.log(POILogger.WARN,
+ "POI does not currently support template.main+xml (glossary) parts. " +
+ "Skipping this part for now.");
+ return;
+ }
+
// add mapping a second time, in case of initial caller hasn't done so
POIXMLDocumentPart otherChild = context.put(pp, this);
if (otherChild != null && otherChild != this) {
import org.apache.poi.xwpf.usermodel.XWPFDocument;
import static org.apache.poi.POITestCase.assertContains;
import static org.apache.poi.POITestCase.assertEndsWith;
+import static org.apache.poi.POITestCase.assertNotContained;
import static org.apache.poi.POITestCase.assertStartsWith;
/**
assertContains(txt, "Sequencing data");
extractor.close();
}
+
+ public void testGlossary() throws IOException {
+ XWPFDocument doc = XWPFTestDataSamples.openSampleDocument("60316.dotx");
+ XWPFWordExtractor extractor = new XWPFWordExtractor(doc);
+ String txt = extractor.getText();
+ assertContains(txt, "Getting the perfect");
+ //this content appears only in the glossary document
+ //once we add processing for this, we can change this to contains
+ assertNotContained(txt, "table rows");
+ }
}