Package org.apache.poi.xslf.usermodel
Class XSLFTextRun
java.lang.Object
org.apache.poi.xslf.usermodel.XSLFTextRun
- All Implemented Interfaces:
HighlightColorSupport,TextRun
Represents a run of text within the containing text body. The run element is the
lowest level text separation mechanism within a text body.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.poi.sl.usermodel.TextRun
TextRun.FieldType, TextRun.TextCap -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondoublegetFontFamily(FontGroup fontGroup) getFontInfo(FontGroup fontGroup) Returns the font highlight (background) color for this text run.byteorg.openxmlformats.schemas.drawingml.x2006.main.CTTextCharacterPropertiesgetRPr(boolean create) Return the character propertiesReturn the text run xmlbeans object.booleanisBold()booleanisItalic()booleanbooleanbooleanbooleanvoidsetBaselineOffset(double baselineOffset) Set the baseline for both the superscript and subscript fonts.voidsetBold(boolean bold) voidsetCharacterSpacing(double spc) Set the spacing between characters within a text run.voidsetFontColor(Color color) voidsetFontColor(PaintStyle color) voidsetFontFamily(String typeface) voidsetFontFamily(String typeface, FontGroup fontGroup) voidsetFontInfo(FontInfo fontInfo, FontGroup fontGroup) voidsetFontSize(Double fontSize) voidsetHighlightColor(Color color) Sets the font highlight (background) color for this text run - convenience functionvoidsetHighlightColor(PaintStyle color) Set the highlight (background) color for this text run.voidsetItalic(boolean italic) voidsetStrikethrough(boolean strike) voidsetSubscript(boolean flag) Set whether the text in this run is formatted as subscript.voidsetSuperscript(boolean flag) Set whether the text in this run is formatted as superscript.voidvoidsetUnderlined(boolean underline) toString()
-
Constructor Details
-
XSLFTextRun
-
-
Method Details
-
getRawText
- Specified by:
getRawTextin interfaceTextRun
-
setText
-
getXmlObject
Return the text run xmlbeans object. Depending on the type of text run, this can beCTTextField,CTTextLineBreakor usually aCTRegularTextRun- Returns:
- the xmlbeans object
-
setFontColor
- Specified by:
setFontColorin interfaceTextRun
-
setFontColor
- Specified by:
setFontColorin interfaceTextRun
-
getFontColor
- Specified by:
getFontColorin interfaceTextRun
-
getHighlightColor
Returns the font highlight (background) color for this text run. This returns aPaintStyle.SolidPaint, or null if no highlight is set.- Specified by:
getHighlightColorin interfaceHighlightColorSupport- Returns:
- The font highlight (background) colour associated with the run, null if no highlight.
- Since:
- 5.2.4
- See Also:
-
setHighlightColor
Sets the font highlight (background) color for this text run - convenience function- Specified by:
setHighlightColorin interfaceHighlightColorSupport- Parameters:
color- The highlight (background) color to set.- Since:
- 5.2.4
-
setHighlightColor
Set the highlight (background) color for this text run.- Specified by:
setHighlightColorin interfaceHighlightColorSupport- Parameters:
color- The highlight (background) color to set.- Throws:
IllegalArgumentException- If the supplied paint style is not null or a SolidPaint.- Since:
- 5.2.4
- See Also:
-
setFontSize
- Specified by:
setFontSizein interfaceTextRun
-
getFontSize
- Specified by:
getFontSizein interfaceTextRun
-
getCharacterSpacing
public double getCharacterSpacing()- Returns:
- the spacing between characters within a text run, If this attribute is omitted than a value of 0 or no adjustment is assumed.
-
setCharacterSpacing
public void setCharacterSpacing(double spc) Set the spacing between characters within a text run.The spacing is specified in points. Positive values will cause the text to expand, negative values to condense.
- Parameters:
spc- character spacing in points.
-
setFontFamily
- Specified by:
setFontFamilyin interfaceTextRun
-
setFontFamily
- Specified by:
setFontFamilyin interfaceTextRun
-
setFontInfo
- Specified by:
setFontInfoin interfaceTextRun
-
getFontFamily
- Specified by:
getFontFamilyin interfaceTextRun
-
getFontFamily
- Specified by:
getFontFamilyin interfaceTextRun
-
getFontInfo
- Specified by:
getFontInfoin interfaceTextRun
-
getPitchAndFamily
public byte getPitchAndFamily()- Specified by:
getPitchAndFamilyin interfaceTextRun
-
setStrikethrough
public void setStrikethrough(boolean strike) - Specified by:
setStrikethroughin interfaceTextRun
-
isStrikethrough
public boolean isStrikethrough()- Specified by:
isStrikethroughin interfaceTextRun
-
isSuperscript
public boolean isSuperscript()- Specified by:
isSuperscriptin interfaceTextRun
-
setBaselineOffset
public void setBaselineOffset(double baselineOffset) Set the baseline for both the superscript and subscript fonts.The size is specified using a percentage. Positive values indicate superscript, negative values indicate subscript.
-
setSuperscript
public void setSuperscript(boolean flag) Set whether the text in this run is formatted as superscript. Default base line offset is 30%- See Also:
-
setSubscript
public void setSubscript(boolean flag) Set whether the text in this run is formatted as subscript. Default base line offset is -25%.- See Also:
-
isSubscript
public boolean isSubscript()- Specified by:
isSubscriptin interfaceTextRun
-
getTextCap
- Specified by:
getTextCapin interfaceTextRun- Returns:
- whether a run of text will be formatted as a superscript text. Default is false.
-
setBold
public void setBold(boolean bold) -
isBold
public boolean isBold() -
setItalic
public void setItalic(boolean italic) -
isItalic
public boolean isItalic() -
setUnderlined
public void setUnderlined(boolean underline) - Specified by:
setUnderlinedin interfaceTextRun
-
isUnderlined
public boolean isUnderlined()- Specified by:
isUnderlinedin interfaceTextRun
-
getRPr
@Internal public org.openxmlformats.schemas.drawingml.x2006.main.CTTextCharacterProperties getRPr(boolean create) Return the character properties- Parameters:
create- if true, create an empty character properties object if it doesn't exist- Returns:
- the character properties or null if create was false and the properties haven't exist
-
toString
-
createHyperlink
- Specified by:
createHyperlinkin interfaceTextRun
-
getHyperlink
- Specified by:
getHyperlinkin interfaceTextRun
-
getFieldType
- Specified by:
getFieldTypein interfaceTextRun
-
getParagraph
- Specified by:
getParagraphin interfaceTextRun
-