From: Yegor Kozlov Date: Thu, 1 Mar 2012 09:51:28 +0000 (+0000) Subject: bugzilla 52682 - allow setting text with trailing carriage return in HSLF X-Git-Tag: REL_3_8_FINAL~15 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=9d449dbd97380e7085257e738e05fec741a4e21d;p=poi.git bugzilla 52682 - allow setting text with trailing carriage return in HSLF git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1295488 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/src/documentation/content/xdocs/status.xml b/src/documentation/content/xdocs/status.xml index aeb943121b..64508fdb80 100644 --- a/src/documentation/content/xdocs/status.xml +++ b/src/documentation/content/xdocs/status.xml @@ -34,6 +34,7 @@ + 52682 - allow setting text with trailing carriage return in HSLF 52244 - use correct text attributes when presentation has multiple TxMasterStyleAtoms of the same type support setting background color of sheet tab in XSSF 51564 - support for enforcing fields update in XWPF diff --git a/src/scratchpad/src/org/apache/poi/hslf/model/TextRun.java b/src/scratchpad/src/org/apache/poi/hslf/model/TextRun.java index 5eb3930638..ee69d87a7d 100644 --- a/src/scratchpad/src/org/apache/poi/hslf/model/TextRun.java +++ b/src/scratchpad/src/org/apache/poi/hslf/model/TextRun.java @@ -320,12 +320,6 @@ public final class TextRun * touch the stylings. */ private void storeText(String s) { - // Remove a single trailing \r, as there is an implicit one at the - // end of every record - if(s.endsWith("\r")) { - s = s.substring(0, s.length()-1); - } - // Store in the appropriate record if(_isUnicode) { // The atom can safely convert to unicode diff --git a/src/scratchpad/testcases/org/apache/poi/hslf/model/TestTextRun.java b/src/scratchpad/testcases/org/apache/poi/hslf/model/TestTextRun.java index f59eef3a5f..a82e551994 100644 --- a/src/scratchpad/testcases/org/apache/poi/hslf/model/TestTextRun.java +++ b/src/scratchpad/testcases/org/apache/poi/hslf/model/TestTextRun.java @@ -100,9 +100,9 @@ public final class TestTextRun extends TestCase { run.setText(changeTo); assertEquals(changeTo, run.getText()); - // Ensure trailing \n's get stripped + // Ensure trailing \n's are NOT stripped, it is legal to set a text with a trailing '\r' run.setText(changeTo + "\n"); - assertEquals(changeTo, run.getText()); + assertEquals(changeTo + "\n", run.getText()); } /**