Also grab text from CStrings, which will get Comments
git-svn-id: https://svn.apache.org/repos/asf/jakarta/poi/trunk@387016 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
30cfb74730
commit
32740c0bb7
@ -28,7 +28,9 @@ import org.apache.poi.poifs.filesystem.DocumentEntry;
|
|||||||
import org.apache.poi.poifs.filesystem.DocumentInputStream;
|
import org.apache.poi.poifs.filesystem.DocumentInputStream;
|
||||||
import org.apache.poi.util.LittleEndian;
|
import org.apache.poi.util.LittleEndian;
|
||||||
|
|
||||||
|
import org.apache.poi.hslf.record.CString;
|
||||||
import org.apache.poi.hslf.record.Record;
|
import org.apache.poi.hslf.record.Record;
|
||||||
|
import org.apache.poi.hslf.record.RecordTypes;
|
||||||
import org.apache.poi.hslf.record.StyleTextPropAtom;
|
import org.apache.poi.hslf.record.StyleTextPropAtom;
|
||||||
import org.apache.poi.hslf.record.TextHeaderAtom;
|
import org.apache.poi.hslf.record.TextHeaderAtom;
|
||||||
import org.apache.poi.hslf.record.TextBytesAtom;
|
import org.apache.poi.hslf.record.TextBytesAtom;
|
||||||
@ -181,17 +183,30 @@ public class QuickButCruddyTextExtractor
|
|||||||
TextRun trun = null;
|
TextRun trun = null;
|
||||||
|
|
||||||
// TextBytesAtom
|
// TextBytesAtom
|
||||||
if(type == 4008l) {
|
if(type == RecordTypes.TextBytesAtom.typeID) {
|
||||||
TextBytesAtom tba = (TextBytesAtom)Record.createRecordForType(type, pptContents, startPos, len+8);
|
TextBytesAtom tba = (TextBytesAtom)Record.createRecordForType(type, pptContents, startPos, len+8);
|
||||||
trun = new TextRun((TextHeaderAtom)null,tba,(StyleTextPropAtom)null);
|
trun = new TextRun((TextHeaderAtom)null,tba,(StyleTextPropAtom)null);
|
||||||
}
|
}
|
||||||
// TextCharsAtom
|
// TextCharsAtom
|
||||||
if(type == 4000l) {
|
if(type == RecordTypes.TextCharsAtom.typeID) {
|
||||||
TextCharsAtom tca = (TextCharsAtom)Record.createRecordForType(type, pptContents, startPos, len+8);
|
TextCharsAtom tca = (TextCharsAtom)Record.createRecordForType(type, pptContents, startPos, len+8);
|
||||||
trun = new TextRun((TextHeaderAtom)null,tca,(StyleTextPropAtom)null);
|
trun = new TextRun((TextHeaderAtom)null,tca,(StyleTextPropAtom)null);
|
||||||
}
|
}
|
||||||
|
|
||||||
// If we found text, save it in the vector
|
// CString (doesn't go via a TextRun)
|
||||||
|
if(type == RecordTypes.CString.typeID) {
|
||||||
|
CString cs = (CString)Record.createRecordForType(type, pptContents, startPos, len+8);
|
||||||
|
String text = cs.getText();
|
||||||
|
|
||||||
|
// Ignore the ones we know to be rubbish
|
||||||
|
if(text.equals("___PPT10")) {
|
||||||
|
} else if(text.equals("Default Design")) {
|
||||||
|
} else {
|
||||||
|
textV.add(text);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// If we found text via a TextRun, save it in the vector
|
||||||
if(trun != null) {
|
if(trun != null) {
|
||||||
textV.add(trun.getText());
|
textV.add(trun.getText());
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user