Font
Inheritance: java.lang.Object
public class Font
Encapsulates the font object used in a spreadsheet.
Example
//Instantiating a Workbook object
Workbook workbook = new Workbook();
//Obtaining the reference of the newly added worksheet by passing its sheet index
Worksheet worksheet = workbook.getWorksheets().get(0);
//Accessing the "A1" cell from the worksheet
Cell cell = worksheet.getCells().get("A1");
//Adding some value to the "A1" cell
cell.putValue("Hello Aspose!");
Font font = cell.getStyle().getFont();
//Setting the font name to "Times New Roman"
font.setName("Times New Roman");
//Setting font size to 14
font.setSize(14);
//setting font color as Red
font.setColor(com.aspose.cells.Color.getRed());
//Saving the Excel file
workbook.save("dest.xls");
Methods
Method | Description |
---|---|
equals(Font font) | Checks if two fonts are equals. |
equals(Object arg0) | |
getArgbColor() | Gets the color with a 32-bit ARGB value. |
getCapsType() | Gets the text caps type. |
getCharset() | Represent the character set. |
getClass() | |
getColor() | Gets the Color of the font. |
getDoubleSize() | Gets the double size of the font. |
getName() | Gets the name of the ChartArea.getFont(). |
getSchemeType() | Gets the scheme type of the font. |
getScriptOffset() | Gets the script offset,in unit of percentage |
getSize() | Gets the size of the font. |
getStrikeType() | Gets the strike type of the text. |
getThemeColor() | Gets the theme color. |
getUnderline() | Gets the font underline type. |
hashCode() | |
isBold() | Gets a value indicating whether the font is bold. |
isItalic() | Gets a value indicating whether the font is italic. |
isNormalizeHeights() | Indicates whether the normalization of height that is to be applied to the text run. |
isStrikeout() | Gets a value indicating whether the font is single strikeout. |
isSubscript() | Gets a value indicating whether the font is subscript. |
isSuperscript() | Gets a value indicating whether the font is super script. |
notify() | |
notifyAll() | |
setArgbColor(int value) | Sets the color with a 32-bit ARGB value. |
setBold(boolean value) | Sets a value indicating whether the font is bold. |
setCapsType(int value) | Sets the text caps type. |
setCharset(int value) | Represent the character set. |
setColor(Color value) | Sets the Color of the font. |
setDoubleSize(double value) | Sets the double size of the font. |
setItalic(boolean value) | Sets a value indicating whether the font is italic. |
setName(String value) | Sets the name of the ChartArea.getFont(). |
setNormalizeHeights(boolean value) | Indicates whether the normalization of height that is to be applied to the text run. |
setSchemeType(int value) | Sets the scheme type of the font. |
setScriptOffset(double value) | Sets the script offset,in unit of percentage |
setSize(int value) | Sets the size of the font. |
setStrikeType(int value) | Gets the strike type of the text. |
setStrikeout(boolean value) | Sets a value indicating whether the font is single strikeout. |
setSubscript(boolean value) | Sets a value indicating whether the font is subscript. |
setSuperscript(boolean value) | Sets a value indicating whether the font is super script. |
setThemeColor(ThemeColor value) | Sets the theme color. |
setUnderline(int value) | Sets the font underline type. |
toString() | Returns a string represents the current Cell object. |
wait() | |
wait(long arg0) | |
wait(long arg0, int arg1) |
equals(Font font)
public boolean equals(Font font)
Checks if two fonts are equals.
Parameters:
Parameter | Type | Description |
---|---|---|
font | Font | Compared font object. |
Returns: boolean - True if equal to the compared font object.
equals(Object arg0)
public boolean equals(Object arg0)
Parameters:
Parameter | Type | Description |
---|---|---|
arg0 | java.lang.Object |
Returns: boolean
getArgbColor()
public int getArgbColor()
Gets the color with a 32-bit ARGB value.
Returns: int
getCapsType()
public int getCapsType()
Gets the text caps type.
See TextCapsType.
Returns: int
getCharset()
public int getCharset()
Represent the character set.
Returns: int
getClass()
public final native Class<?> getClass()
Returns: java.lang.Class
getColor()
public Color getColor()
Gets the Color of the font.
Returns: Color
getDoubleSize()
public double getDoubleSize()
Gets the double size of the font.
Returns: double
getName()
public String getName()
Gets the name of the ChartArea.getFont().
Returns: java.lang.String
getSchemeType()
public int getSchemeType()
Gets the scheme type of the font.
See FontSchemeType.
Returns: int
getScriptOffset()
public double getScriptOffset()
Gets the script offset,in unit of percentage
Returns: double
getSize()
public int getSize()
Gets the size of the font.
Returns: int
getStrikeType()
public int getStrikeType()
Gets the strike type of the text.
See TextStrikeType.
Returns: int
getThemeColor()
public ThemeColor getThemeColor()
Gets the theme color.
Remarks
If the font color is not a theme color, NULL will be returned.
Returns: ThemeColor
getUnderline()
public int getUnderline()
Gets the font underline type.
See FontUnderlineType.
Returns: int
hashCode()
public native int hashCode()
Returns: int
isBold()
public boolean isBold()
Gets a value indicating whether the font is bold.
Returns: boolean
isItalic()
public boolean isItalic()
Gets a value indicating whether the font is italic.
Returns: boolean
isNormalizeHeights()
public boolean isNormalizeHeights()
Indicates whether the normalization of height that is to be applied to the text run.
Returns: boolean
isStrikeout()
public boolean isStrikeout()
Gets a value indicating whether the font is single strikeout.
Returns: boolean
isSubscript()
public boolean isSubscript()
Gets a value indicating whether the font is subscript.
Returns: boolean
isSuperscript()
public boolean isSuperscript()
Gets a value indicating whether the font is super script.
Returns: boolean
notify()
public final native void notify()
notifyAll()
public final native void notifyAll()
setArgbColor(int value)
public void setArgbColor(int value)
Sets the color with a 32-bit ARGB value.
Parameters:
Parameter | Type | Description |
---|---|---|
value | int |
setBold(boolean value)
public void setBold(boolean value)
Sets a value indicating whether the font is bold.
Parameters:
Parameter | Type | Description |
---|---|---|
value | boolean |
setCapsType(int value)
public void setCapsType(int value)
Sets the text caps type.
See TextCapsType.
Parameters:
Parameter | Type | Description |
---|---|---|
value | int |
setCharset(int value)
public void setCharset(int value)
Represent the character set.
Parameters:
Parameter | Type | Description |
---|---|---|
value | int |
setColor(Color value)
public void setColor(Color value)
Sets the Color of the font.
Parameters:
Parameter | Type | Description |
---|---|---|
value | Color |
setDoubleSize(double value)
public void setDoubleSize(double value)
Sets the double size of the font.
Parameters:
Parameter | Type | Description |
---|---|---|
value | double |
setItalic(boolean value)
public void setItalic(boolean value)
Sets a value indicating whether the font is italic.
Parameters:
Parameter | Type | Description |
---|---|---|
value | boolean |
setName(String value)
public void setName(String value)
Sets the name of the ChartArea.getFont().
Parameters:
Parameter | Type | Description |
---|---|---|
value | java.lang.String |
setNormalizeHeights(boolean value)
public void setNormalizeHeights(boolean value)
Indicates whether the normalization of height that is to be applied to the text run.
Parameters:
Parameter | Type | Description |
---|---|---|
value | boolean |
setSchemeType(int value)
public void setSchemeType(int value)
Sets the scheme type of the font.
See FontSchemeType.
Parameters:
Parameter | Type | Description |
---|---|---|
value | int |
setScriptOffset(double value)
public void setScriptOffset(double value)
Sets the script offset,in unit of percentage
Parameters:
Parameter | Type | Description |
---|---|---|
value | double |
setSize(int value)
public void setSize(int value)
Sets the size of the font.
Parameters:
Parameter | Type | Description |
---|---|---|
value | int |
setStrikeType(int value)
public void setStrikeType(int value)
Gets the strike type of the text.
See TextStrikeType.
Parameters:
Parameter | Type | Description |
---|---|---|
value | int |
setStrikeout(boolean value)
public void setStrikeout(boolean value)
Sets a value indicating whether the font is single strikeout.
Parameters:
Parameter | Type | Description |
---|---|---|
value | boolean |
setSubscript(boolean value)
public void setSubscript(boolean value)
Sets a value indicating whether the font is subscript.
Parameters:
Parameter | Type | Description |
---|---|---|
value | boolean |
setSuperscript(boolean value)
public void setSuperscript(boolean value)
Sets a value indicating whether the font is super script.
Parameters:
Parameter | Type | Description |
---|---|---|
value | boolean |
setThemeColor(ThemeColor value)
public void setThemeColor(ThemeColor value)
Sets the theme color.
Remarks
If the font color is not a theme color, NULL will be returned.
Parameters:
Parameter | Type | Description |
---|---|---|
value | ThemeColor |
setUnderline(int value)
public void setUnderline(int value)
Sets the font underline type.
See FontUnderlineType.
Parameters:
Parameter | Type | Description |
---|---|---|
value | int |
toString()
public String toString()
Returns a string represents the current Cell object.
Returns: java.lang.String -
wait()
public final void wait()
wait(long arg0)
public final native void wait(long arg0)
Parameters:
Parameter | Type | Description |
---|---|---|
arg0 | long |
wait(long arg0, int arg1)
public final void wait(long arg0, int arg1)
Parameters:
Parameter | Type | Description |
---|---|---|
arg0 | long | |
arg1 | int |