Skip to content

Commit

Permalink
[bug-68703] fix issue with XSLFTextRuns in XSLFTableCells
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1916105 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
pjfanning committed Mar 4, 2024
1 parent 9d14f3f commit 1c156c4
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ private interface Procedure {
if (r instanceof CTTextLineBreak) {
_runs.add(new XSLFLineBreak((CTTextLineBreak)r, this));
} else if (r instanceof CTRegularTextRun || r instanceof CTTextField) {
_runs.add(this.newTextRun(r));
_runs.add(new XSLFTextRun(r, this));
}
} while (c.toNextSibling());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -228,4 +228,19 @@ void testCorrectlyReadsTextRunStylingForCellsWithTheme() throws IOException {
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());
}
}

}
Binary file added test-data/slideshow/bug68703.pptx
Binary file not shown.

0 comments on commit 1c156c4

Please sign in to comment.