FormattedText

Inheritance: java.lang.Object

public final class FormattedText

Class which represents formatted text. Contains information about text and its color, size, style.

Constructors

ConstructorDescription
FormattedText()Initializes FormattedText.
FormattedText(String text)Initializes FormattedText.
FormattedText(String text, FontColor fontColor, FontStyle fontStyle, int encodingType, boolean embedded, float textSize)Initializes FormattedText.
FormattedText(String text, FontColor fontColor, FontStyle textFont, int textEncoding, boolean embedded, float textSize, float lineSpacing)Initialize FormattedText.
FormattedText(String text, Color color, FontStyle textFont, int textEncoding, boolean embedded, float textSize)Initializes FormattedText.
FormattedText(String text, Color textColor, FontStyle textFont, int textEncoding, boolean embedded, float textSize, float lineSpacing)Initializes FormattedText.
FormattedText(String text, FontColor textColor, FontColor backColor, FontStyle textFont, int textEncoding, boolean embedded, float textSize)Initializes FormattedText.
FormattedText(String text, FontColor textColor, FontColor backColor, FontStyle textFont, int textEncoding, boolean embedded, float textSize, float lineSpacing)Initializes FormattedText.
FormattedText(String text, Color textColor, Color backColor, FontStyle textFont, int encoding, boolean embedded, float textSize)Initializes FormattedText.
FormattedText(String text, Color textColor, Color backColor, FontStyle textFont, int textEncoding, boolean embedded, float textSize, float lineSpacing)Initializes FormattedText.
FormattedText(String text, Color textColor, Color backColor, String fontName, int textEncoding, boolean embedded, float fontSize)Initializes FormattedText.
FormattedText(String text, Color textColor, Color backColor)Initializes FormattedText.
FormattedText(String text, Color textColor, String fontName, int textEncoding, boolean embedded, float fontSize)Initializes FormattedText.

Methods

MethodDescription
getText()For Internal usage only
getFirstLine()Gets first line
getTextColor()Internal Gets text color
getBackColor()Internal Gets back color
getFont()Gets font
getFontSize()Gets font size
getTextHeight()Gets height of text.
getTextWidth()Gets width of text.
addNewLineText(String newLineText)Adds a new line to the FormattedText object and sets the newLineText to the next line’s text.
addNewLineText(String newLineText, float lineSpacing)Adds a new line to the FormattedText object and sets the newLineText to the next line’s text.
isCjk()Checks if text is CJK (Chinese, Japanese, or Korean).
setCjkFontStyle()Changes FormattedText font style for CJK (Chinese, Japanese, or Korean) font.

FormattedText()

public FormattedText()

Initializes FormattedText.

FormattedText(String text)

public FormattedText(String text)

Initializes FormattedText.

Parameters:

ParameterTypeDescription
textjava.lang.StringText which contained in FormattedText.

FormattedText(String text, FontColor fontColor, FontStyle fontStyle, int encodingType, boolean embedded, float textSize)

public FormattedText(String text, FontColor fontColor, FontStyle fontStyle, int encodingType, boolean embedded, float textSize)

Initializes FormattedText.

Parameters:

ParameterTypeDescription
textjava.lang.StringText content of the string.
fontColorFontColorColor of the text.
fontStyleFontStyleStyle of the text.
encodingTypeintEncoding type (value of EncodingType enumeration).
embeddedbooleanTrue if the font will be embedded.
textSizefloatSize of the text.

FormattedText(String text, FontColor fontColor, FontStyle textFont, int textEncoding, boolean embedded, float textSize, float lineSpacing)

public FormattedText(String text, FontColor fontColor, FontStyle textFont, int textEncoding, boolean embedded, float textSize, float lineSpacing)

Initialize FormattedText.

Parameters:

ParameterTypeDescription
textjava.lang.StringText content of the string.
fontColorFontColorColor of the text.
textFontFontStyleFont of the text.
textEncodingintEncoding of the text.
embeddedbooleanTrue if text will be embedded.
textSizefloatSize of the text.
lineSpacingfloatAdditional spacing.

FormattedText(String text, Color color, FontStyle textFont, int textEncoding, boolean embedded, float textSize)

public FormattedText(String text, Color color, FontStyle textFont, int textEncoding, boolean embedded, float textSize)

Initializes FormattedText.

Parameters:

ParameterTypeDescription
textjava.lang.StringText content of the string.
colorjava.awt.ColorColor of the text.
textFontFontStyleFont of the text.
textEncodingintEncoding of the text.
embeddedbooleanTrue if text will be embedded.
textSizefloatSize of the text.

FormattedText(String text, Color textColor, FontStyle textFont, int textEncoding, boolean embedded, float textSize, float lineSpacing)

public FormattedText(String text, Color textColor, FontStyle textFont, int textEncoding, boolean embedded, float textSize, float lineSpacing)

Initializes FormattedText.

Parameters:

ParameterTypeDescription
textjava.lang.StringText contents of the string.
textColorjava.awt.ColorColor of the text.
textFontFontStyleFont of the text.
textEncodingintEncoding of the text.
embeddedbooleanIf true font will be embedded.
textSizefloatSize of the text.
lineSpacingfloatAdditional spacing.

FormattedText(String text, FontColor textColor, FontColor backColor, FontStyle textFont, int textEncoding, boolean embedded, float textSize)

public FormattedText(String text, FontColor textColor, FontColor backColor, FontStyle textFont, int textEncoding, boolean embedded, float textSize)

Initializes FormattedText.

Parameters:

ParameterTypeDescription
textjava.lang.StringText content of the string.
textColorFontColorColor of the text.
backColorFontColorColor of background.
textFontFontStyleFont of the text.
textEncodingintEncoding of the text.
embeddedbooleanIf true font will be embedded.
textSizefloatSize of the text.

FormattedText(String text, FontColor textColor, FontColor backColor, FontStyle textFont, int textEncoding, boolean embedded, float textSize, float lineSpacing)

public FormattedText(String text, FontColor textColor, FontColor backColor, FontStyle textFont, int textEncoding, boolean embedded, float textSize, float lineSpacing)

Initializes FormattedText.

Parameters:

ParameterTypeDescription
textjava.lang.StringText content.
textColorFontColorColor of the text.
backColorFontColorColor of background.
textFontFontStyleFont of the text.
textEncodingintEncoding of the text.
embeddedbooleanIf true font will be embedded.
textSizefloatSize of the text.
lineSpacingfloatAdditional spacing.

FormattedText(String text, Color textColor, Color backColor, FontStyle textFont, int encoding, boolean embedded, float textSize)

public FormattedText(String text, Color textColor, Color backColor, FontStyle textFont, int encoding, boolean embedded, float textSize)

Initializes FormattedText.

Parameters:

ParameterTypeDescription
textjava.lang.StringText content of the string.
textColorjava.awt.ColorColor of the text.
backColorjava.awt.ColorColor of background.
textFontFontStyleFont of the text.
encodingintEncoding of the text.
embeddedbooleanTrue if font will be embedded.
textSizefloatSize of the text.

FormattedText(String text, Color textColor, Color backColor, FontStyle textFont, int textEncoding, boolean embedded, float textSize, float lineSpacing)

public FormattedText(String text, Color textColor, Color backColor, FontStyle textFont, int textEncoding, boolean embedded, float textSize, float lineSpacing)

Initializes FormattedText.

Parameters:

ParameterTypeDescription
textjava.lang.StringText contents of the string.
textColorjava.awt.ColorColor of the text.
backColorjava.awt.ColorColor of the background.
textFontFontStyleFont of the text.
textEncodingintEncoding of the text.
embeddedbooleanIf true font is embedded.
textSizefloatSize of the text.
lineSpacingfloatAdditional spacing.

FormattedText(String text, Color textColor, Color backColor, String fontName, int textEncoding, boolean embedded, float fontSize)

public FormattedText(String text, Color textColor, Color backColor, String fontName, int textEncoding, boolean embedded, float fontSize)

Initializes FormattedText.

Parameters:

ParameterTypeDescription
textjava.lang.StringText content.
textColorjava.awt.ColorColor of the text.
backColorjava.awt.ColorColor of background.
fontNamejava.lang.StringFont of the text.
textEncodingintEncoding of the text.
embeddedbooleanIf true font will be embedded.
fontSizefloatSize of the text.

FormattedText(String text, Color textColor, Color backColor)

public FormattedText(String text, Color textColor, Color backColor)

Initializes FormattedText.

Parameters:

ParameterTypeDescription
textjava.lang.StringText content.
textColorjava.awt.ColorColor of the text.
backColorjava.awt.ColorColor of background.

FormattedText(String text, Color textColor, String fontName, int textEncoding, boolean embedded, float fontSize)

public FormattedText(String text, Color textColor, String fontName, int textEncoding, boolean embedded, float fontSize)

Initializes FormattedText.

Parameters:

ParameterTypeDescription
textjava.lang.StringText content.
textColorjava.awt.ColorColor of the text.
fontNamejava.lang.StringFont of the text.
textEncodingintEncoding of the text.
embeddedbooleanIf true font will be embedded.
fontSizefloatSize of the text.

getText()

public System.Collections.Generic.List<String> getText()

For Internal usage only

Returns: com.aspose.ms.System.Collections.Generic.List<java.lang.String> - Internal object

getFirstLine()

public String getFirstLine()

Gets first line

Returns: java.lang.String - String value

getTextColor()

public System.Drawing.Color getTextColor()

Internal Gets text color

Returns: Color - Color element

getBackColor()

public System.Drawing.Color getBackColor()

Internal Gets back color

Returns: Color - Color element

getFont()

public Font getFont()

Gets font

Returns: Font - Font element

getFontSize()

public float getFontSize()

Gets font size

Returns: float - float value

getTextHeight()

public float getTextHeight()

Gets height of text.

Returns: float - float value

getTextWidth()

public float getTextWidth()

Gets width of text.

Returns: float - float value

addNewLineText(String newLineText)

public void addNewLineText(String newLineText)

Adds a new line to the FormattedText object and sets the newLineText to the next line’s text.

Parameters:

ParameterTypeDescription
newLineTextjava.lang.StringText of new added line.

addNewLineText(String newLineText, float lineSpacing)

public void addNewLineText(String newLineText, float lineSpacing)

Adds a new line to the FormattedText object and sets the newLineText to the next line’s text.

Parameters:

ParameterTypeDescription
newLineTextjava.lang.StringText of new added line.
lineSpacingfloatSpacing of the line.

isCjk()

public final boolean isCjk()

Checks if text is CJK (Chinese, Japanese, or Korean).

Returns: boolean - True if text is CJK. Otherwise false.

setCjkFontStyle()

public final void setCjkFontStyle()

Changes FormattedText font style for CJK (Chinese, Japanese, or Korean) font.