FormattedText
Inheritance: java.lang.Object
public final class FormattedText
Class which represents formatted text. Contains information about text and its color, size, style.
Constructors
Methods
Method | Description |
---|---|
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:
Parameter | Type | Description |
---|---|---|
text | java.lang.String | Text 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:
Parameter | Type | Description |
---|---|---|
text | java.lang.String | Text content of the string. |
fontColor | FontColor | Color of the text. |
fontStyle | FontStyle | Style of the text. |
encodingType | int | Encoding type (value of EncodingType enumeration). |
embedded | boolean | True if the font will be embedded. |
textSize | float | Size 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:
Parameter | Type | Description |
---|---|---|
text | java.lang.String | Text content of the string. |
fontColor | FontColor | Color of the text. |
textFont | FontStyle | Font of the text. |
textEncoding | int | Encoding of the text. |
embedded | boolean | True if text will be embedded. |
textSize | float | Size of the text. |
lineSpacing | float | Additional 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:
Parameter | Type | Description |
---|---|---|
text | java.lang.String | Text content of the string. |
color | java.awt.Color | Color of the text. |
textFont | FontStyle | Font of the text. |
textEncoding | int | Encoding of the text. |
embedded | boolean | True if text will be embedded. |
textSize | float | Size 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:
Parameter | Type | Description |
---|---|---|
text | java.lang.String | Text contents of the string. |
textColor | java.awt.Color | Color of the text. |
textFont | FontStyle | Font of the text. |
textEncoding | int | Encoding of the text. |
embedded | boolean | If true font will be embedded. |
textSize | float | Size of the text. |
lineSpacing | float | Additional 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:
Parameter | Type | Description |
---|---|---|
text | java.lang.String | Text content of the string. |
textColor | FontColor | Color of the text. |
backColor | FontColor | Color of background. |
textFont | FontStyle | Font of the text. |
textEncoding | int | Encoding of the text. |
embedded | boolean | If true font will be embedded. |
textSize | float | Size 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:
Parameter | Type | Description |
---|---|---|
text | java.lang.String | Text content. |
textColor | FontColor | Color of the text. |
backColor | FontColor | Color of background. |
textFont | FontStyle | Font of the text. |
textEncoding | int | Encoding of the text. |
embedded | boolean | If true font will be embedded. |
textSize | float | Size of the text. |
lineSpacing | float | Additional 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:
Parameter | Type | Description |
---|---|---|
text | java.lang.String | Text content of the string. |
textColor | java.awt.Color | Color of the text. |
backColor | java.awt.Color | Color of background. |
textFont | FontStyle | Font of the text. |
encoding | int | Encoding of the text. |
embedded | boolean | True if font will be embedded. |
textSize | float | Size 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:
Parameter | Type | Description |
---|---|---|
text | java.lang.String | Text contents of the string. |
textColor | java.awt.Color | Color of the text. |
backColor | java.awt.Color | Color of the background. |
textFont | FontStyle | Font of the text. |
textEncoding | int | Encoding of the text. |
embedded | boolean | If true font is embedded. |
textSize | float | Size of the text. |
lineSpacing | float | Additional 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:
Parameter | Type | Description |
---|---|---|
text | java.lang.String | Text content. |
textColor | java.awt.Color | Color of the text. |
backColor | java.awt.Color | Color of background. |
fontName | java.lang.String | Font of the text. |
textEncoding | int | Encoding of the text. |
embedded | boolean | If true font will be embedded. |
fontSize | float | Size of the text. |
FormattedText(String text, Color textColor, Color backColor)
public FormattedText(String text, Color textColor, Color backColor)
Initializes FormattedText.
Parameters:
Parameter | Type | Description |
---|---|---|
text | java.lang.String | Text content. |
textColor | java.awt.Color | Color of the text. |
backColor | java.awt.Color | Color 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:
Parameter | Type | Description |
---|---|---|
text | java.lang.String | Text content. |
textColor | java.awt.Color | Color of the text. |
fontName | java.lang.String | Font of the text. |
textEncoding | int | Encoding of the text. |
embedded | boolean | If true font will be embedded. |
fontSize | float | Size 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:
Parameter | Type | Description |
---|---|---|
newLineText | java.lang.String | Text 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:
Parameter | Type | Description |
---|---|---|
newLineText | java.lang.String | Text of new added line. |
lineSpacing | float | Spacing 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.