From 3c47eec7d8b693a4387d81596a32b053689bdee5 Mon Sep 17 00:00:00 2001 From: Nick Burch Date: Sun, 19 Mar 2006 18:44:10 +0000 Subject: [PATCH] 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 --- .../QuickButCruddyTextExtractor.java | 21 ++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/src/scratchpad/src/org/apache/poi/hslf/extractor/QuickButCruddyTextExtractor.java b/src/scratchpad/src/org/apache/poi/hslf/extractor/QuickButCruddyTextExtractor.java index c089167533..757b672bd0 100644 --- a/src/scratchpad/src/org/apache/poi/hslf/extractor/QuickButCruddyTextExtractor.java +++ b/src/scratchpad/src/org/apache/poi/hslf/extractor/QuickButCruddyTextExtractor.java @@ -28,7 +28,9 @@ import org.apache.poi.poifs.filesystem.DocumentEntry; import org.apache.poi.poifs.filesystem.DocumentInputStream; 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.RecordTypes; import org.apache.poi.hslf.record.StyleTextPropAtom; import org.apache.poi.hslf.record.TextHeaderAtom; import org.apache.poi.hslf.record.TextBytesAtom; @@ -181,17 +183,30 @@ public class QuickButCruddyTextExtractor TextRun trun = null; // TextBytesAtom - if(type == 4008l) { + if(type == RecordTypes.TextBytesAtom.typeID) { TextBytesAtom tba = (TextBytesAtom)Record.createRecordForType(type, pptContents, startPos, len+8); trun = new TextRun((TextHeaderAtom)null,tba,(StyleTextPropAtom)null); } // TextCharsAtom - if(type == 4000l) { + if(type == RecordTypes.TextCharsAtom.typeID) { TextCharsAtom tca = (TextCharsAtom)Record.createRecordForType(type, pptContents, startPos, len+8); trun = new TextRun((TextHeaderAtom)null,tca,(StyleTextPropAtom)null); } + + // 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, save it in the vector + // If we found text via a TextRun, save it in the vector if(trun != null) { textV.add(trun.getText()); } -- 2.39.5