--- src/scratchpad/src/org/apache/poi/hslf/model/TextRun.java (revision 693898) +++ src/scratchpad/src/org/apache/poi/hslf/model/TextRun.java (working copy) @@ -484,7 +484,21 @@ LinkedList cStyles = _styleAtom.getCharacterStyles(); while(cStyles.size() > 1) { cStyles.removeLast(); } + + // [djb 09/07/2008] reset any style data now so that subsequent call to + // changeTextInRichTextRun will have the correct style info + // update the lengths +1 for since these will be the only runs + if (pStyles.size() ==1) { + TextPropCollection prPara = (TextPropCollection)pStyles.getFirst(); + prPara.updateTextSize( s.length() +1 ); + } + if (cStyles.size() ==1) { + TextPropCollection prChar = (TextPropCollection)cStyles.getFirst(); + prChar.updateTextSize( s.length() +1 ); + } + // [djb 09/07/2008] + _rtRuns[0].setText(s); } else { // Recreate rich text run with no styling