Package org.apache.poi.ss.usermodel
Interface RichTextString
- All Known Implementing Classes:
HSSFRichTextString
,XSSFRichTextString
public interface RichTextString
Rich text unicode string. These strings can have fonts
applied to arbitary parts of the string.
- Author:
- Glen Stampoultzis (glens at apache.org), Jason Height (jheight at apache.org)
-
Method Summary
Modifier and TypeMethodDescriptionvoid
applyFont
(int startIndex, int endIndex, short fontIndex) Applies a font to the specified characters of a string.void
Applies a font to the specified characters of a string.void
applyFont
(short fontIndex) Applies the specified font to the entire string.void
Sets the font of the entire string.void
Removes any formatting that may have been applied to the string.int
getIndexOfFormattingRun
(int index) The index within the string to which the specified formatting run applies.Returns the plain string representation.int
length()
int
-
Method Details
-
applyFont
void applyFont(int startIndex, int endIndex, short fontIndex) Applies a font to the specified characters of a string.- Parameters:
startIndex
- The start index to apply the font to (inclusive)endIndex
- The end index to apply the font to (exclusive)fontIndex
- The font to use.
-
applyFont
Applies a font to the specified characters of a string.- Parameters:
startIndex
- The start index to apply the font to (inclusive)endIndex
- The end index to apply to font to (exclusive)font
- The index of the font to use.
-
applyFont
Sets the font of the entire string.- Parameters:
font
- The font to use.
-
clearFormatting
void clearFormatting()Removes any formatting that may have been applied to the string. -
getString
String getString()Returns the plain string representation. -
length
int length()- Returns:
- the number of characters in the font.
-
numFormattingRuns
int numFormattingRuns()- Returns:
- The number of formatting runs used.
-
getIndexOfFormattingRun
int getIndexOfFormattingRun(int index) The index within the string to which the specified formatting run applies.- Parameters:
index
- the index of the formatting run- Returns:
- the index within the string.
-
applyFont
void applyFont(short fontIndex) Applies the specified font to the entire string.- Parameters:
fontIndex
- the font to apply.
-