return getCharacterRun( numCharacterRuns() - 1 );
}
+ /**
+ * Inserts text into the front of this range and it gives that text the
+ * CharacterProperties specified in props.
+ *
+ * @param text
+ * The text to insert.
+ * @param props
+ * The CharacterProperties to give the text.
+ * @return A new CharacterRun that has the given text and properties and is
+ * n ow a part of the document.
+ * @deprecated POI 3.8 beta 4. User code should not work with {@link CharacterProperties}
+ */
+ @Deprecated
+ private CharacterRun insertBefore(String text, CharacterProperties props)
+ {
+ initAll();
+ PAPX papx = _paragraphs.get(_parStart);
+ short istd = papx.getIstd();
+
+ StyleSheet ss = _doc.getStyleSheet();
+ CharacterProperties baseStyle = ss.getCharacterStyle(istd);
+ byte[] grpprl = CharacterSprmCompressor.compressCharacterProperty(props, baseStyle);
+ SprmBuffer buf = new SprmBuffer(grpprl, 0);
+ _doc.getCharacterTable().insert(_charStart, _start, buf);
+
+ return insertBefore(text);
+ }
+
+ /**
+ * Inserts text onto the end of this range and gives that text the
+ * CharacterProperties specified in props.
+ *
+ * @param text
+ * The text to insert.
+ * @param props
+ * The CharacterProperties to give the text.
+ * @return A new CharacterRun that has the given text and properties and is
+ * n ow a part of the document.
+ * @deprecated POI 3.8 beta 4. User code should not work with {@link CharacterProperties}
+ */
+ @Deprecated
+ private CharacterRun insertAfter(String text, CharacterProperties props)
+ {
+ initAll();
+ PAPX papx = _paragraphs.get(_parEnd - 1);
+ short istd = papx.getIstd();
+
+ StyleSheet ss = _doc.getStyleSheet();
+ CharacterProperties baseStyle = ss.getCharacterStyle(istd);
+ byte[] grpprl = CharacterSprmCompressor.compressCharacterProperty(props, baseStyle);
+ SprmBuffer buf = new SprmBuffer(grpprl, 0);
+ _doc.getCharacterTable().insert(_charEnd, _end, buf);
+ _charEnd++;
+ return insertAfter(text);
+ }
+
+ /**
+ * Inserts and empty paragraph into the front of this range.
+ *
+ * @param props
+ * The properties that the new paragraph will have.
+ * @param styleIndex
+ * The index into the stylesheet for the new paragraph.
+ * @return The newly inserted paragraph.
+ * @deprecated POI 3.8 beta 4. Use code shall not work with {@link ParagraphProperties}
+ */
+ @Deprecated
+ private Paragraph insertBefore(ParagraphProperties props, int styleIndex)
+ {
+ return this.insertBefore(props, styleIndex, "\r");
+ }
+
+ /**
+ * Inserts a paragraph into the front of this range. The paragraph will
+ * contain one character run that has the default properties for the
+ * paragraph's style.
+ *
+ * It is necessary for the text to end with the character '\r'
+ *
+ * @param props
+ * The paragraph's properties.
+ * @param styleIndex
+ * The index of the paragraph's style in the style sheet.
+ * @param text
+ * The text to insert.
+ * @return A newly inserted paragraph.
+ * @deprecated POI 3.8 beta 4. Use code shall not work with {@link ParagraphProperties}
+ */
+ @Deprecated
+ private Paragraph insertBefore(ParagraphProperties props, int styleIndex, String text)
+ {
+ initAll();
+ StyleSheet ss = _doc.getStyleSheet();
+ ParagraphProperties baseStyle = ss.getParagraphStyle(styleIndex);
+ CharacterProperties baseChp = ss.getCharacterStyle(styleIndex);
+
+ byte[] grpprl = ParagraphSprmCompressor.compressParagraphProperty(props, baseStyle);
+ byte[] withIndex = new byte[grpprl.length + LittleEndian.SHORT_SIZE];
+ LittleEndian.putShort(withIndex, 0, (short) styleIndex);
+ System.arraycopy(grpprl, 0, withIndex, LittleEndian.SHORT_SIZE, grpprl.length);
+ SprmBuffer buf = new SprmBuffer(withIndex, 2);
+
+ _doc.getParagraphTable().insert(_parStart, _start, buf);
+ insertBefore(text, baseChp);
+ return getParagraph(0);
+ }
+
+ /**
+ * Inserts and empty paragraph into the end of this range.
+ *
+ * @param props
+ * The properties that the new paragraph will have.
+ * @param styleIndex
+ * The index into the stylesheet for the new paragraph.
+ * @return The newly inserted paragraph.
+ * @deprecated POI 3.8 beta 4. Use code shall not work with {@link ParagraphProperties}
+ */
+ @Deprecated
+ protected Paragraph insertAfter(ParagraphProperties props, int styleIndex)
+ {
+ return this.insertAfter(props, styleIndex, "\r");
+ }
+
+ /**
+ * Inserts a paragraph into the end of this range. The paragraph will
+ * contain one character run that has the default properties for the
+ * paragraph's style.
+ *
+ * It is necessary for the text to end with the character '\r'
+ *
+ * @param props
+ * The paragraph's properties.
+ * @param styleIndex
+ * The index of the paragraph's style in the style sheet.
+ * @param text
+ * The text to insert.
+ * @return A newly inserted paragraph.
+ * @deprecated POI 3.8 beta 4. Use code shall not work with {@link ParagraphProperties}
+ */
+ @Deprecated
+ protected Paragraph insertAfter(ParagraphProperties props, int styleIndex, String text)
+ {
+ initAll();
+ StyleSheet ss = _doc.getStyleSheet();
+ ParagraphProperties baseStyle = ss.getParagraphStyle(styleIndex);
+ CharacterProperties baseChp = ss.getCharacterStyle(styleIndex);
+
+ byte[] grpprl = ParagraphSprmCompressor.compressParagraphProperty(props, baseStyle);
+ byte[] withIndex = new byte[grpprl.length + LittleEndian.SHORT_SIZE];
+ LittleEndian.putShort(withIndex, 0, (short) styleIndex);
+ System.arraycopy(grpprl, 0, withIndex, LittleEndian.SHORT_SIZE, grpprl.length);
+ SprmBuffer buf = new SprmBuffer(withIndex, 2);
+
+ _doc.getParagraphTable().insert(_parEnd, _end, buf);
+ _parEnd++;
+ insertAfter(text, baseChp);
+ return getParagraph(numParagraphs() - 1);
+ }
+
public void delete() {
initAll();