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

MethodDescription
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:

ParameterTypeDescription
fontFontCompared font object.

Returns: boolean - True if equal to the compared font object.

equals(Object arg0)

public boolean equals(Object arg0)

Parameters:

ParameterTypeDescription
arg0java.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:

ParameterTypeDescription
valueint

setBold(boolean value)

public void setBold(boolean value)

Sets a value indicating whether the font is bold.

Parameters:

ParameterTypeDescription
valueboolean

setCapsType(int value)

public void setCapsType(int value)

Sets the text caps type.

See TextCapsType.

Parameters:

ParameterTypeDescription
valueint

setCharset(int value)

public void setCharset(int value)

Represent the character set.

Parameters:

ParameterTypeDescription
valueint

setColor(Color value)

public void setColor(Color value)

Sets the Color of the font.

Parameters:

ParameterTypeDescription
valueColor

setDoubleSize(double value)

public void setDoubleSize(double value)

Sets the double size of the font.

Parameters:

ParameterTypeDescription
valuedouble

setItalic(boolean value)

public void setItalic(boolean value)

Sets a value indicating whether the font is italic.

Parameters:

ParameterTypeDescription
valueboolean

setName(String value)

public void setName(String value)

Sets the name of the ChartArea.getFont().

Parameters:

ParameterTypeDescription
valuejava.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:

ParameterTypeDescription
valueboolean

setSchemeType(int value)

public void setSchemeType(int value)

Sets the scheme type of the font.

See FontSchemeType.

Parameters:

ParameterTypeDescription
valueint

setScriptOffset(double value)

public void setScriptOffset(double value)

Sets the script offset,in unit of percentage

Parameters:

ParameterTypeDescription
valuedouble

setSize(int value)

public void setSize(int value)

Sets the size of the font.

Parameters:

ParameterTypeDescription
valueint

setStrikeType(int value)

public void setStrikeType(int value)

Gets the strike type of the text.

See TextStrikeType.

Parameters:

ParameterTypeDescription
valueint

setStrikeout(boolean value)

public void setStrikeout(boolean value)

Sets a value indicating whether the font is single strikeout.

Parameters:

ParameterTypeDescription
valueboolean

setSubscript(boolean value)

public void setSubscript(boolean value)

Sets a value indicating whether the font is subscript.

Parameters:

ParameterTypeDescription
valueboolean

setSuperscript(boolean value)

public void setSuperscript(boolean value)

Sets a value indicating whether the font is super script.

Parameters:

ParameterTypeDescription
valueboolean

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:

ParameterTypeDescription
valueThemeColor

setUnderline(int value)

public void setUnderline(int value)

Sets the font underline type.

See FontUnderlineType.

Parameters:

ParameterTypeDescription
valueint

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:

ParameterTypeDescription
arg0long

wait(long arg0, int arg1)

public final void wait(long arg0, int arg1)

Parameters:

ParameterTypeDescription
arg0long
arg1int