mirror of https://github.com/apache/poi.git
insert the content of fldSimple fields into the XWPFWordTextExtractor output, see bug #49455
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@979538 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
af0406cd10
commit
c9f9d48ff8
|
@ -34,6 +34,7 @@
|
|||
|
||||
<changes>
|
||||
<release version="3.7-beta2" date="2010-??-??">
|
||||
<action dev="POI-DEVELOPERS" type="add">49455 - Insert the content of fldSimple fields into the XWPFWordTextExtractor output</action>
|
||||
<action dev="POI-DEVELOPERS" type="add">49640 - Fixed parsing formulas containing defined names beginning with an underscore</action>
|
||||
<action dev="POI-DEVELOPERS" type="add">49538 - Added implementation for POISSON()</action>
|
||||
<action dev="POI-DEVELOPERS" type="add">49524 - Support for setting cell text to be vertically rotated, via style.setRotation(0xff)</action>
|
||||
|
|
|
@ -20,6 +20,7 @@ import java.math.BigInteger;
|
|||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Arrays;
|
||||
|
||||
import org.apache.poi.util.Internal;
|
||||
import org.apache.xmlbeans.XmlCursor;
|
||||
|
@ -41,6 +42,7 @@ import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTRPr;
|
|||
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTRunTrackChange;
|
||||
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTSdtContentRun;
|
||||
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTSdtRun;
|
||||
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTSimpleField;
|
||||
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTSpacing;
|
||||
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTString;
|
||||
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTText;
|
||||
|
@ -119,6 +121,9 @@ public class XWPFParagraph implements IBodyElement{
|
|||
for (CTRunTrackChange c : paragraph.getInsList()) {
|
||||
rs.addAll( c.getRList() );
|
||||
}
|
||||
for (CTSimpleField f : paragraph.getFldSimpleList()) {
|
||||
rs.addAll( f.getRList() );
|
||||
}
|
||||
|
||||
// Get text of the paragraph
|
||||
for (int j = 0; j < rs.size(); j++) {
|
||||
|
|
|
@ -250,4 +250,16 @@ public class TestXWPFWordExtractor extends TestCase {
|
|||
assertFalse(text.contains("AUTHOR"));
|
||||
assertFalse(text.contains("CREATEDATE"));
|
||||
}
|
||||
|
||||
/**
|
||||
* The output should contain the values of simple fields, those specified
|
||||
* with the fldSimple element (spec sec. 17.16.19)
|
||||
*/
|
||||
public void testFldSimpleContent() {
|
||||
XWPFDocument doc = XWPFTestDataSamples.openSampleDocument("FldSimple.docx");
|
||||
XWPFWordExtractor extractor = new XWPFWordExtractor(doc);
|
||||
String text = extractor.getText();
|
||||
assertTrue(text.length() > 0);
|
||||
assertTrue(text.contains("FldSimple.docx"));
|
||||
}
|
||||
}
|
||||
|
|
Binary file not shown.
Loading…
Reference in New Issue