aboutsummaryrefslogtreecommitdiffstats
path: root/src/ooxml/java
diff options
context:
space:
mode:
authorYegor Kozlov <yegor@apache.org>2009-07-18 09:09:11 +0000
committerYegor Kozlov <yegor@apache.org>2009-07-18 09:09:11 +0000
commitd09ab59ab0fd9f480c3781a6cae6dcabfd7e7f43 (patch)
tree1c2b61d84dda6cb1e56c0bba6390c05350120482 /src/ooxml/java
parenteda8d9631c316fcc1ff9f2e28887ea6a53995ef9 (diff)
downloadpoi-d09ab59ab0fd9f480c3781a6cae6dcabfd7e7f43.tar.gz
poi-d09ab59ab0fd9f480c3781a6cae6dcabfd7e7f43.zip
Fixed ExtractorFactory to support .xltx and .dotx files, see Bugzilla 47517
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@795327 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/ooxml/java')
-rw-r--r--src/ooxml/java/org/apache/poi/extractor/ExtractorFactory.java23
1 files changed, 16 insertions, 7 deletions
diff --git a/src/ooxml/java/org/apache/poi/extractor/ExtractorFactory.java b/src/ooxml/java/org/apache/poi/extractor/ExtractorFactory.java
index dc25f63a38..a313f36026 100644
--- a/src/ooxml/java/org/apache/poi/extractor/ExtractorFactory.java
+++ b/src/ooxml/java/org/apache/poi/extractor/ExtractorFactory.java
@@ -94,18 +94,27 @@ public class ExtractorFactory {
if(core.size() != 1) {
throw new IllegalArgumentException("Invalid OOXML Package received - expected 1 core document, found " + core.size());
}
-
- PackagePart corePart = pkg.getPart(core.getRelationship(0));
- if(corePart.getContentType().equals(XSSFRelation.WORKBOOK.getContentType())) {
- return new XSSFExcelExtractor(pkg);
- }
- if(corePart.getContentType().equals(XWPFRelation.DOCUMENT.getContentType())) {
+
+ PackagePart corePart = pkg.getPart(core.getRelationship(0));
+ if (corePart.getContentType().equals(XSSFRelation.WORKBOOK.getContentType()) ||
+ corePart.getContentType().equals(XSSFRelation.MACRO_TEMPLATE_WORKBOOK.getContentType()) ||
+ corePart.getContentType().equals(XSSFRelation.MACRO_ADDIN_WORKBOOK.getContentType()) ||
+ corePart.getContentType().equals(XSSFRelation.TEMPLATE_WORKBOOK.getContentType()) ||
+ corePart.getContentType().equals(XSSFRelation.MACROS_WORKBOOK.getContentType())) {
+ return new XSSFExcelExtractor(pkg);
+ }
+
+ if(corePart.getContentType().equals(XWPFRelation.DOCUMENT.getContentType()) ||
+ corePart.getContentType().equals(XWPFRelation.TEMPLATE.getContentType()) ||
+ corePart.getContentType().equals(XWPFRelation.MACRO_DOCUMENT.getContentType()) ||
+ corePart.getContentType().equals(XWPFRelation.MACRO_TEMPLATE_DOCUMENT.getContentType()) ) {
return new XWPFWordExtractor(pkg);
}
+
if(corePart.getContentType().equals(XSLFSlideShow.MAIN_CONTENT_TYPE)) {
return new XSLFPowerPointExtractor(pkg);
}
- throw new IllegalArgumentException("No supported documents found in the OOXML package");
+ throw new IllegalArgumentException("No supported documents found in the OOXML package (found "+corePart.getContentType()+")");
}
public static POIOLE2TextExtractor createExtractor(POIFSFileSystem fs) throws IOException {