<changes>
<release version="3.7-SNAPSHOT" date="2010-??-??">
+ <action dev="POI-DEVELOPERS" type="add">Add PublisherTextExtractor support to ExtractorFactory</action>
<action dev="POI-DEVELOPERS" type="add">Add XSLF support for text extraction from tables</action>
<action dev="POI-DEVELOPERS" type="add">Support attachments as embeded documents within the new OutlookTextExtractor</action>
<action dev="POI-DEVELOPERS" type="add">Add a text extractor (OutlookTextExtractor) to HSMF for simpler extraction of text from .msg files</action>
import org.apache.poi.POIXMLDocument;
import org.apache.poi.POIXMLTextExtractor;
import org.apache.poi.hdgf.extractor.VisioTextExtractor;
+import org.apache.poi.hpbf.extractor.PublisherTextExtractor;
import org.apache.poi.hslf.extractor.PowerPointExtractor;
import org.apache.poi.hsmf.MAPIMessage;
import org.apache.poi.hsmf.datatypes.AttachmentChunks;
if(entry.getName().equals("VisioDocument")) {
return new VisioTextExtractor(poifsDir, fs);
}
+ if(entry.getName().equals("Quill")) {
+ return new PublisherTextExtractor(poifsDir, fs);
+ }
if(
entry.getName().equals("__substg1.0_1000001E") ||
entry.getName().equals("__substg1.0_1000001F") ||
import org.apache.poi.POITextExtractor;
import org.apache.poi.POIDataSamples;
import org.apache.poi.hdgf.extractor.VisioTextExtractor;
+import org.apache.poi.hpbf.extractor.PublisherTextExtractor;
import org.apache.poi.hslf.extractor.PowerPointExtractor;
import org.apache.poi.hsmf.extractor.OutlookTextExtactor;
import org.apache.poi.hssf.extractor.ExcelExtractor;
private File msgEmb;
private File vsd;
+
+ private File pub;
protected void setUp() throws Exception {
super.setUp();
POIDataSamples dgTests = POIDataSamples.getDiagramInstance();
vsd = dgTests.getFile("Test_Visio-Some_Random_Text.vsd");
+ POIDataSamples pubTests = POIDataSamples.getPublisherInstance();
+ pub = pubTests.getFile("Simple.pub");
+
POIDataSamples olTests = POIDataSamples.getHSMFInstance();
msg = olTests.getFile("quick.msg");
msgEmb = olTests.getFile("attachment_test_msg.msg");
ExtractorFactory.createExtractor(vsd).getText().length() > 50
);
+ // Publisher
+ assertTrue(
+ ExtractorFactory.createExtractor(pub)
+ instanceof PublisherTextExtractor
+ );
+ assertTrue(
+ ExtractorFactory.createExtractor(pub).getText().length() > 50
+ );
+
// Outlook msg
assertTrue(
ExtractorFactory.createExtractor(msg)
ExtractorFactory.createExtractor(new FileInputStream(vsd)).getText().length() > 50
);
+ // Publisher
+ assertTrue(
+ ExtractorFactory.createExtractor(new FileInputStream(pub))
+ instanceof PublisherTextExtractor
+ );
+ assertTrue(
+ ExtractorFactory.createExtractor(new FileInputStream(pub)).getText().length() > 50
+ );
+
// Outlook msg
assertTrue(
ExtractorFactory.createExtractor(new FileInputStream(msg))
assertTrue(
ExtractorFactory.createExtractor(new POIFSFileSystem(new FileInputStream(vsd))).getText().length() > 50
);
+
+ // Publisher
+ assertTrue(
+ ExtractorFactory.createExtractor(new POIFSFileSystem(new FileInputStream(pub)))
+ instanceof PublisherTextExtractor
+ );
+ assertTrue(
+ ExtractorFactory.createExtractor(new POIFSFileSystem(new FileInputStream(pub))).getText().length() > 50
+ );
// Outlook msg
assertTrue(
assertEquals(1, numWord);
// TODO - PowerPoint
+ // TODO - Publisher
// TODO - Visio
}
}
import org.apache.poi.hpbf.model.qcbits.QCBit;
import org.apache.poi.hpbf.model.qcbits.QCTextBit;
import org.apache.poi.hpbf.model.qcbits.QCPLCBit.Type12;
+import org.apache.poi.poifs.filesystem.DirectoryNode;
import org.apache.poi.poifs.filesystem.POIFSFileSystem;
/**
super(doc);
this.doc = doc;
}
+ public PublisherTextExtractor(DirectoryNode dir, POIFSFileSystem fs) throws IOException {
+ this(new HPBFDocument(dir, fs));
+ }
public PublisherTextExtractor(POIFSFileSystem fs) throws IOException {
this(new HPBFDocument(fs));
}