ASF Bugzilla – Attachment 23964 Details for
Bug 47517
[PATCH] Extractor does not support XLTX and DOTX files
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
patch
patch (text/plain), 5.16 KB, created by
Maxim Valyanskiy
on 2009-07-13 05:32:04 UTC
(
hide
)
Description:
patch
Filename:
MIME Type:
Creator:
Maxim Valyanskiy
Created:
2009-07-13 05:32:04 UTC
Size:
5.16 KB
patch
obsolete
>Index: src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFRelation.java >=================================================================== >--- src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFRelation.java (revision 793473) >+++ src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFRelation.java (working copy) >@@ -63,6 +63,12 @@ > "/xl/workbook.xml", > null > ); >+ public static final XSSFRelation TEMPLATE_WORKBOOK = new XSSFRelation( >+ "application/vnd.openxmlformats-officedocument.spreadsheetml.template.main+xml", >+ "http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument", >+ "/xl/workbook.xml", >+ null >+ ); > public static final XSSFRelation WORKSHEET = new XSSFRelation( > "application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml", > "http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet", >Index: src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFRelation.java >=================================================================== >--- src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFRelation.java (revision 793473) >+++ src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFRelation.java (working copy) >@@ -40,6 +40,12 @@ > "/word/document.xml", > null > ); >+ public static final XWPFRelation TEMPLATE = new XWPFRelation( >+ "application/vnd.openxmlformats-officedocument.wordprocessingml.template.main+xml", >+ "http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument", >+ "/word/document.xml", >+ null >+ ); > public static final XWPFRelation FONT_TABLE = new XWPFRelation( > "application/vnd.openxmlformats-officedocument.wordprocessingml.fontTable+xml", > "http://schemas.openxmlformats.org/officeDocument/2006/relationships/fontTable", >Index: src/ooxml/java/org/apache/poi/extractor/ExtractorFactory.java >=================================================================== >--- src/ooxml/java/org/apache/poi/extractor/ExtractorFactory.java (revision 793473) >+++ src/ooxml/java/org/apache/poi/extractor/ExtractorFactory.java (working copy) >@@ -99,13 +99,19 @@ > if(corePart.getContentType().equals(XSSFRelation.WORKBOOK.getContentType())) { > return new XSSFExcelExtractor(pkg); > } >+ if(corePart.getContentType().equals(XSSFRelation.TEMPLATE_WORKBOOK.getContentType())) { >+ return new XSSFExcelExtractor(pkg); >+ } > if(corePart.getContentType().equals(XWPFRelation.DOCUMENT.getContentType())) { > return new XWPFWordExtractor(pkg); > } >+ if(corePart.getContentType().equals(XWPFRelation.TEMPLATE.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 { >Index: src/ooxml/testcases/org/apache/poi/extractor/TestExtractorFactory.java >=================================================================== >--- src/ooxml/testcases/org/apache/poi/extractor/TestExtractorFactory.java (revision 793473) >+++ src/ooxml/testcases/org/apache/poi/extractor/TestExtractorFactory.java (working copy) >@@ -50,9 +50,11 @@ > > private File xls; > private File xlsx; >- >+ private File xltx; >+ > private File doc; > private File docx; >+ private File dotx; > > private File ppt; > private File pptx; >@@ -77,10 +79,12 @@ > > xls = new File(excel_dir, "SampleSS.xls"); > xlsx = new File(excel_dir, "SampleSS.xlsx"); >- >+ xltx = new File(excel_dir, "test.xltx"); >+ > doc = new File(word_dir, "SampleDoc.doc"); > docx = new File(word_dir, "SampleDoc.docx"); >- >+ dotx = new File(word_dir, "test.dotx"); >+ > ppt = new File(powerpoint_dir, "SampleShow.ppt"); > pptx = new File(powerpoint_dir, "SampleShow.pptx"); > >@@ -104,6 +108,15 @@ > assertTrue( > ExtractorFactory.createExtractor(xlsx).getText().length() > 200 > ); >+ >+ assertTrue( >+ ExtractorFactory.createExtractor(xltx) >+ instanceof XSSFExcelExtractor >+ ); >+ assertTrue( >+ ExtractorFactory.createExtractor(xltx).getText().contains("test") >+ ); >+ > > // Word > assertTrue( >@@ -121,7 +134,15 @@ > assertTrue( > ExtractorFactory.createExtractor(docx).getText().length() > 120 > ); >- >+ >+ assertTrue( >+ ExtractorFactory.createExtractor(dotx) >+ instanceof XWPFWordExtractor >+ ); >+ assertTrue( >+ ExtractorFactory.createExtractor(dotx).getText().contains("Test") >+ ); >+ > // PowerPoint > assertTrue( > ExtractorFactory.createExtractor(ppt)
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 47517
: 23964 |
23965
|
23966
|
23991
|
24002