Browse Source

[bug-68703] fix issue with XSLFTextRuns in XSLFTableCells

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1916105 13f79535-47bb-0310-9956-ffa450edef68
pull/604/head
PJ Fanning 2 months ago
parent
commit
1c156c4005

+ 1
- 1
poi-ooxml/src/main/java/org/apache/poi/xslf/usermodel/XSLFTextParagraph.java View File

if (r instanceof CTTextLineBreak) { if (r instanceof CTTextLineBreak) {
_runs.add(new XSLFLineBreak((CTTextLineBreak)r, this)); _runs.add(new XSLFLineBreak((CTTextLineBreak)r, this));
} else if (r instanceof CTRegularTextRun || r instanceof CTTextField) { } else if (r instanceof CTRegularTextRun || r instanceof CTTextField) {
_runs.add(this.newTextRun(r));
_runs.add(new XSLFTextRun(r, this));
} }
} while (c.toNextSibling()); } while (c.toNextSibling());
} }

+ 15
- 0
poi-ooxml/src/test/java/org/apache/poi/xslf/usermodel/TestXSLFTableCell.java View File

ppt.close(); ppt.close();
} }


@Test
void testBug68703() throws IOException {
try(XMLSlideShow pptx = XSLFTestDataSamples.openSampleDocument("bug68703.pptx")) {
XSLFSlide firstSlide = pptx.getSlides().get(0);
XSLFTable table = (XSLFTable) firstSlide.getShapes().get(0);
XSLFTableCell cell = table.getCell(0, 0);
List<XSLFTextParagraph> cellParagraphs = cell.getTextParagraphs();
List<XSLFTextRun> cellTextRuns = cellParagraphs.get(0).getTextRuns();
PaintStyle fontColor = cellTextRuns.get(0).getFontColor();
assertNotNull(fontColor);
assertTrue(fontColor instanceof PaintStyle.SolidPaint);
assertEquals(Color.black, ((PaintStyle.SolidPaint) fontColor).getSolidColor().getColor());
}
}

} }

BIN
test-data/slideshow/bug68703.pptx View File


Loading…
Cancel
Save