mirror of https://github.com/apache/poi.git
Fix bug 61787, which was introduced by bug 58067: Change how deleted content is detected to not incorrectly see too much text as deleted.
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1819405 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
67683086b5
commit
8197a53eca
|
@ -148,6 +148,12 @@ public class XWPFParagraph implements IBodyElement, IRunBody, ISDTContents, Para
|
|||
// This implementation does not preserve the tagging information
|
||||
buildRunsInOrderFromXml(o);
|
||||
}
|
||||
if (o instanceof CTRunTrackChange) {
|
||||
// add all the insertions as text
|
||||
for (CTRunTrackChange change : ((CTRunTrackChange) o).getInsArray()) {
|
||||
buildRunsInOrderFromXml(change);
|
||||
}
|
||||
}
|
||||
}
|
||||
c.dispose();
|
||||
}
|
||||
|
@ -189,7 +195,7 @@ public class XWPFParagraph implements IBodyElement, IRunBody, ISDTContents, Para
|
|||
if (run instanceof XWPFRun) {
|
||||
XWPFRun xRun = (XWPFRun) run;
|
||||
// don't include the text if reviewing is enabled and this is a deleted run
|
||||
if (!xRun.getCTR().isSetRsidDel()) {
|
||||
if (xRun.getCTR().getDelTextArray().length == 0) {
|
||||
out.append(xRun);
|
||||
}
|
||||
} else if (run instanceof XWPFSDT) {
|
||||
|
|
|
@ -414,7 +414,9 @@ public final class TestXWPFParagraph {
|
|||
//CTMoveBookmarkImpl into ooxml-lite.
|
||||
XWPFDocument doc = XWPFTestDataSamples.openSampleDocument("Tika-792.docx");
|
||||
XWPFParagraph paragraph = doc.getParagraphs().get(0);
|
||||
assertEquals("s", paragraph.getText());
|
||||
assertEquals("", paragraph.getText());
|
||||
paragraph = doc.getParagraphs().get(1);
|
||||
assertEquals("b", paragraph.getText());
|
||||
doc.close();
|
||||
}
|
||||
|
||||
|
@ -612,7 +614,19 @@ public final class TestXWPFParagraph {
|
|||
}
|
||||
assertEquals("This is a test.\n\n\n\n3\n4\n5\n\n\n\nThis is a whole paragraph where one word is deleted.\n", str.toString());
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void test61787() throws IOException {
|
||||
XWPFDocument doc = XWPFTestDataSamples.openSampleDocument("61787.docx");
|
||||
|
||||
StringBuilder str = new StringBuilder();
|
||||
for(XWPFParagraph par : doc.getParagraphs()) {
|
||||
str.append(par.getText()).append("\n");
|
||||
}
|
||||
String s = str.toString();
|
||||
assertTrue("Having text: \n" + s + "\nTrimmed lenght: " + s.trim().length(), s.trim().length() > 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests for numbered lists
|
||||
*
|
||||
|
|
Binary file not shown.
Loading…
Reference in New Issue