poi-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject [Bug 55966] New: Text contents of content controls within paragraphs, not appearing in XWPFWordExtractor.getText()
Date Tue, 07 Jan 2014 16:38:30 GMT
https://issues.apache.org/bugzilla/show_bug.cgi?id=55966

            Bug ID: 55966
           Summary: Text contents of content controls within paragraphs,
                    not appearing in XWPFWordExtractor.getText()
           Product: POI
           Version: 3.10-dev
          Hardware: PC
            Status: NEW
          Severity: normal
          Priority: P2
         Component: XWPF
          Assignee: dev@poi.apache.org
          Reporter: ben+poi@benbat.com

Created attachment 31177
  --> https://issues.apache.org/bugzilla/attachment.cgi?id=31177&action=edit
Word document with 3 content controls

When calling getText() the contents of the content controls is not returned
when the content control is within a paragraph with other text.

When the content control is the only item then the text is there.

This appears to be the exact opposite of the behaviour in 3.9 where text in a
content control where that is the only item in a paragraph doesn't appear
though that in a paragraph with other text does. (That fix appears to have been
in the onDocumentRead() method of org.apache.poi.xwpf.XWPFDocument).

I've used the following test (and attached document to demonstrate the problem.


    public void test_manualDoc() throws FileNotFoundException, IOException  {
        String filepath = "resources/contentcontrol.docx";
        String expected = "Content control within a paragraph is here text
content from within a paragraph second control with a new\nline\n\nContent
control that is the entire paragraph";

        XWPFDocument doc = new XWPFDocument(new FileInputStream(filepath));
        XWPFWordExtractor extractedDoc = new XWPFWordExtractor(doc);

        String actual = extractedDoc.getText();

        extractedDoc.close();
        Assert.assertEquals(expected, actual);

    }

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


Mime
View raw message