diff --git a/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFRichTextString.java b/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFRichTextString.java index fe3e27b10d..d1fdf6b4b6 100644 --- a/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFRichTextString.java +++ b/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFRichTextString.java @@ -390,7 +390,7 @@ public class XSSFRichTextString implements RichTextString { * Return a copy of the font in use at a particular index. * * @param index The index. - * @return A copy of the font that's currently being applied at that + * @return A copy of the font that's currently being applied at that * index or null if no font is being applied or the * index is out of range. */ diff --git a/poi-ooxml/src/test/java/org/apache/poi/xssf/usermodel/TestXSSFTextParagraph.java b/poi-ooxml/src/test/java/org/apache/poi/xssf/usermodel/TestXSSFTextParagraph.java index 8244ca2d91..17daaf102c 100644 --- a/poi-ooxml/src/test/java/org/apache/poi/xssf/usermodel/TestXSSFTextParagraph.java +++ b/poi-ooxml/src/test/java/org/apache/poi/xssf/usermodel/TestXSSFTextParagraph.java @@ -90,7 +90,7 @@ class TestXSSFTextParagraph { text.setBulletFontColor(color); assertEquals(color, text.getBulletFontColor()); - final byte[] colorBytes = new byte[] { (byte) 255, 127, 0 }; + final byte[] colorBytes = new byte[]{(byte) 255, 127, 0}; text.setBulletFontColor(colorBytes); assertArrayEquals(colorBytes, text.getBulletFontColorAsBytes()); @@ -196,4 +196,32 @@ class TestXSSFTextParagraph { new XSSFTextParagraph(text.getXmlObject(), shape.getCTShape()); } } + + @Test + void testXSSFTextParagraph2() throws IOException { + try (XSSFWorkbook wb = new XSSFWorkbook()) { + XSSFSheet sheet = wb.createSheet(); + XSSFDrawing drawing = sheet.createDrawingPatriarch(); + + XSSFTextBox shape = drawing.createTextbox(new XSSFClientAnchor(0, 0, 0, 0, 2, 2, 3, 4)); + XSSFTextRun run = shape.getTextParagraphs().get(0).getTextRuns().get(0); + final byte[] colorBytes = new byte[]{0, (byte) 255, (byte) 255}; + run.setFont("Arial"); + run.setFontColor(colorBytes); + run.setText("Test String"); + + List paras = shape.getTextParagraphs(); + assertEquals(1, paras.size()); + + XSSFTextParagraph text = paras.get(0); + assertEquals("Test String", text.getText()); + + List runs = text.getTextRuns(); + assertEquals(1, runs.size()); + XSSFTextRun run2 = runs.get(0); + assertEquals(run.getText(), run2.getText()); + assertEquals(run.getFontFamily(), run2.getFontFamily()); + assertArrayEquals(run.getFontColorAsBytes(), run2.getFontColorAsBytes()); + } + } }