Author: fanningpj
Date: Mon Mar  4 12:49:02 2024
New Revision: 1916105

URL: http://svn.apache.org/viewvc?rev=1916105&view=rev
Log:
[bug-68703] fix issue with XSLFTextRuns in XSLFTableCells

Added:
    poi/trunk/test-data/slideshow/bug68703.pptx   (with props)
Modified:
    
poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xslf/usermodel/XSLFTextParagraph.java
    
poi/trunk/poi-ooxml/src/test/java/org/apache/poi/xslf/usermodel/TestXSLFTableCell.java

Modified: 
poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xslf/usermodel/XSLFTextParagraph.java
URL: 
http://svn.apache.org/viewvc/poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xslf/usermodel/XSLFTextParagraph.java?rev=1916105&r1=1916104&r2=1916105&view=diff
==============================================================================
--- 
poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xslf/usermodel/XSLFTextParagraph.java
 (original)
+++ 
poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xslf/usermodel/XSLFTextParagraph.java
 Mon Mar  4 12:49:02 2024
@@ -75,7 +75,7 @@ public class XSLFTextParagraph implement
                     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());
             }

Modified: 
poi/trunk/poi-ooxml/src/test/java/org/apache/poi/xslf/usermodel/TestXSLFTableCell.java
URL: 
http://svn.apache.org/viewvc/poi/trunk/poi-ooxml/src/test/java/org/apache/poi/xslf/usermodel/TestXSLFTableCell.java?rev=1916105&r1=1916104&r2=1916105&view=diff
==============================================================================
--- 
poi/trunk/poi-ooxml/src/test/java/org/apache/poi/xslf/usermodel/TestXSLFTableCell.java
 (original)
+++ 
poi/trunk/poi-ooxml/src/test/java/org/apache/poi/xslf/usermodel/TestXSLFTableCell.java
 Mon Mar  4 12:49:02 2024
@@ -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());
+        }
+    }
+
 }

Added: poi/trunk/test-data/slideshow/bug68703.pptx
URL: 
http://svn.apache.org/viewvc/poi/trunk/test-data/slideshow/bug68703.pptx?rev=1916105&view=auto
==============================================================================
Binary file - no diff available.

Propchange: poi/trunk/test-data/slideshow/bug68703.pptx
------------------------------------------------------------------------------
--- svn:mime-type (added)
+++ svn:mime-type Mon Mar  4 12:49:02 2024
@@ -0,0 +1 @@
+application/vnd.openxmlformats-officedocument.presentationml.presentation



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to