Package org.apache.poi.xslf.usermodel
Class XSLFTextRun
- java.lang.Object
-
- org.apache.poi.xslf.usermodel.XSLFTextRun
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.apache.poi.sl.usermodel.TextRun
TextRun.FieldType, TextRun.TextCap
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedXSLFTextRun(XmlObject r, XSLFTextParagraph p)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description XSLFHyperlinkcreateHyperlink()doublegetCharacterSpacing()TextRun.FieldTypegetFieldType()PaintStylegetFontColor()StringgetFontFamily()StringgetFontFamily(FontGroup fontGroup)FontInfogetFontInfo(FontGroup fontGroup)DoublegetFontSize()XSLFHyperlinkgetHyperlink()XSLFTextParagraphgetParagraph()bytegetPitchAndFamily()StringgetRawText()org.openxmlformats.schemas.drawingml.x2006.main.CTTextCharacterPropertiesgetRPr(boolean create)Return the character propertiesTextRun.TextCapgetTextCap()XmlObjectgetXmlObject()Return the text run xmlbeans object.booleanisBold()booleanisItalic()booleanisStrikethrough()booleanisSubscript()booleanisSuperscript()booleanisUnderlined()voidsetBaselineOffset(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)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.voidsetText(String text)voidsetUnderlined(boolean underline)StringtoString()
-
-
-
Constructor Detail
-
XSLFTextRun
protected XSLFTextRun(XmlObject r, XSLFTextParagraph p)
-
-
Method Detail
-
getRawText
public String getRawText()
- Specified by:
getRawTextin interfaceTextRun
-
getXmlObject
@Internal public XmlObject 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
public void setFontColor(Color color)
- Specified by:
setFontColorin interfaceTextRun
-
setFontColor
public void setFontColor(PaintStyle color)
- Specified by:
setFontColorin interfaceTextRun
-
getFontColor
public PaintStyle getFontColor()
- Specified by:
getFontColorin interfaceTextRun
-
setFontSize
public void setFontSize(Double fontSize)
- Specified by:
setFontSizein interfaceTextRun
-
getFontSize
public Double 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
public void setFontFamily(String typeface)
- Specified by:
setFontFamilyin interfaceTextRun
-
setFontFamily
public void setFontFamily(String typeface, FontGroup fontGroup)
- Specified by:
setFontFamilyin interfaceTextRun
-
setFontInfo
public void setFontInfo(FontInfo fontInfo, FontGroup fontGroup)
- Specified by:
setFontInfoin interfaceTextRun
-
getFontFamily
public String getFontFamily()
- Specified by:
getFontFamilyin interfaceTextRun
-
getFontFamily
public String getFontFamily(FontGroup fontGroup)
- Specified by:
getFontFamilyin interfaceTextRun
-
getFontInfo
public FontInfo getFontInfo(FontGroup fontGroup)
- 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:
setBaselineOffset(double)
-
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:
setBaselineOffset(double)
-
isSubscript
public boolean isSubscript()
- Specified by:
isSubscriptin interfaceTextRun
-
getTextCap
public TextRun.TextCap getTextCap()
- Specified by:
getTextCapin interfaceTextRun- Returns:
- whether a run of text will be formatted as a superscript text. Default is false.
-
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
-
createHyperlink
public XSLFHyperlink createHyperlink()
- Specified by:
createHyperlinkin interfaceTextRun
-
getHyperlink
public XSLFHyperlink getHyperlink()
- Specified by:
getHyperlinkin interfaceTextRun
-
getFieldType
public TextRun.FieldType getFieldType()
- Specified by:
getFieldTypein interfaceTextRun
-
getParagraph
public XSLFTextParagraph getParagraph()
- Specified by:
getParagraphin interfaceTextRun
-
-