diff options
author | PJ Fanning <fanningpj@apache.org> | 2024-03-04 12:49:02 +0000 |
---|---|---|
committer | PJ Fanning <fanningpj@apache.org> | 2024-03-04 12:49:02 +0000 |
commit | 1c156c4005173605dd520f31edc514546e447fe9 (patch) | |
tree | dc25f838562d9fd58a7e9d95ef3148eb457ac33d /poi-ooxml/src | |
parent | 9d14f3f9eebbc82c3a16d64fdc0cc41d294381d0 (diff) | |
download | poi-1c156c4005173605dd520f31edc514546e447fe9.tar.gz poi-1c156c4005173605dd520f31edc514546e447fe9.zip |
[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
Diffstat (limited to 'poi-ooxml/src')
-rw-r--r-- | poi-ooxml/src/main/java/org/apache/poi/xslf/usermodel/XSLFTextParagraph.java | 2 | ||||
-rw-r--r-- | poi-ooxml/src/test/java/org/apache/poi/xslf/usermodel/TestXSLFTableCell.java | 15 |
2 files changed, 16 insertions, 1 deletions
diff --git a/poi-ooxml/src/main/java/org/apache/poi/xslf/usermodel/XSLFTextParagraph.java b/poi-ooxml/src/main/java/org/apache/poi/xslf/usermodel/XSLFTextParagraph.java index 60b648244b..d8bcd25f1d 100644 --- a/poi-ooxml/src/main/java/org/apache/poi/xslf/usermodel/XSLFTextParagraph.java +++ b/poi-ooxml/src/main/java/org/apache/poi/xslf/usermodel/XSLFTextParagraph.java @@ -75,7 +75,7 @@ public class XSLFTextParagraph implements TextParagraph<XSLFShape,XSLFTextParagr 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()); } diff --git a/poi-ooxml/src/test/java/org/apache/poi/xslf/usermodel/TestXSLFTableCell.java b/poi-ooxml/src/test/java/org/apache/poi/xslf/usermodel/TestXSLFTableCell.java index f7df4ed611..87bb0ce6a2 100644 --- a/poi-ooxml/src/test/java/org/apache/poi/xslf/usermodel/TestXSLFTableCell.java +++ b/poi-ooxml/src/test/java/org/apache/poi/xslf/usermodel/TestXSLFTableCell.java @@ -228,4 +228,19 @@ class TestXSLFTableCell 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()); + } + } + } |