All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.aspose.cells.Font.html Maven / Gradle / Ivy

There is a newer version: 23.1
Show newest version





Font




com.aspose.cells
Class Font

java.lang.Object
    extended by com.aspose.cells.Font
Direct Known Subclasses:
TextOptions

public class Font 
extends java.lang.Object

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!");

Style style = cell.getStyle();
Font font = style.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());

cell.setStyle(style);

//Saving the Excel file
workbook.save("d:\\dest.xls");


Property Getters/Setters Summary
intgetArgbColor()
voidsetArgbColor(int)
           Gets and sets the color with a 32-bit ARGB value.
intgetCapsType()
voidsetCapsType(int)
           Gets and sets the text caps type. The value of the property is TextCapsType integer constant.
intgetCharset()
voidsetCharset(int)
           Represent the character set.
com.aspose.cells.ColorgetColor()
voidsetColor(com.aspose.cells.Color)
           Gets or sets the com.aspose.cells.Color of the font.
doublegetDoubleSize()
voidsetDoubleSize(double)
           Gets and sets the double size of the font.
booleanisBold()
voidsetBold(boolean)
           Gets or sets a value indicating whether the font is bold.
booleanisItalic()
voidsetItalic(boolean)
           Gets or sets a value indicating whether the font is italic.
booleanisNormalizeHeights()
voidsetNormalizeHeights(boolean)
           Indicates whether the normalization of height that is to be applied to the text run.
booleanisStrikeout()
voidsetStrikeout(boolean)
           Gets or sets a value indicating whether the font is single strikeout.
booleanisSubscript()
voidsetSubscript(boolean)
           Gets or sets a value indicating whether the font is subscript.
booleanisSuperscript()
voidsetSuperscript(boolean)
           Gets or sets a value indicating whether the font is super script.
java.lang.StringgetName()
voidsetName(java.lang.String)
           Gets or sets the name of the Font.
intgetSchemeType()
voidsetSchemeType(int)
           Gets and sets the scheme type of the font. The value of the property is FontSchemeType integer constant.
doublegetScriptOffset()
voidsetScriptOffset(double)
           Gets and sets the script offset,in unit of percentage
intgetSize()
voidsetSize(int)
           Gets or sets the size of the font.
intgetStrikeType()
voidsetStrikeType(int)
           Gets the strike type of the text. The value of the property is TextStrikeType integer constant.
ThemeColorgetThemeColor()
voidsetThemeColor(ThemeColor)
           Gets and sets the theme color.
intgetUnderline()
voidsetUnderline(int)
           Gets or sets the font underline type. The value of the property is FontUnderlineType integer constant.
 
Method Summary
booleanequals(Font font)
           Checks if two fonts are equals.
java.lang.StringtoString()
           Returns a string represents the current Cell object.
 

Property Getters/Setters Detail

getCharset/setCharset

public int getCharset() / public void setCharset(int value)
Represent the character set.

setCharset

public void setCharset(int value)
Represent the character set.

isItalic/setItalic

public boolean isItalic() / public void setItalic(boolean value)
Gets or sets a value indicating whether the font is italic.

setItalic

public void setItalic(boolean value)
Gets or sets a value indicating whether the font is italic.

isBold/setBold

public boolean isBold() / public void setBold(boolean value)
Gets or sets a value indicating whether the font is bold.

setBold

public void setBold(boolean value)
Gets or sets a value indicating whether the font is bold.

getCapsType/setCapsType

public int getCapsType() / public void setCapsType(int value)
Gets and sets the text caps type. The value of the property is TextCapsType integer constant.

setCapsType

public void setCapsType(int value)
Gets and sets the text caps type. The value of the property is TextCapsType integer constant.

getStrikeType/setStrikeType

public int getStrikeType() / public void setStrikeType(int value)
Gets the strike type of the text. The value of the property is TextStrikeType integer constant.

setStrikeType

public void setStrikeType(int value)
Gets the strike type of the text. The value of the property is TextStrikeType integer constant.

isStrikeout/setStrikeout

public boolean isStrikeout() / public void setStrikeout(boolean value)
Gets or sets a value indicating whether the font is single strikeout.

setStrikeout

public void setStrikeout(boolean value)
Gets or sets a value indicating whether the font is single strikeout.

getScriptOffset/setScriptOffset

public double getScriptOffset() / public void setScriptOffset(double value)
Gets and sets the script offset,in unit of percentage

setScriptOffset

public void setScriptOffset(double value)
Gets and sets the script offset,in unit of percentage

isSuperscript/setSuperscript

public boolean isSuperscript() / public void setSuperscript(boolean value)
Gets or sets a value indicating whether the font is super script.

setSuperscript

public void setSuperscript(boolean value)
Gets or sets a value indicating whether the font is super script.

isSubscript/setSubscript

public boolean isSubscript() / public void setSubscript(boolean value)
Gets or sets a value indicating whether the font is subscript.

setSubscript

public void setSubscript(boolean value)
Gets or sets a value indicating whether the font is subscript.

getUnderline/setUnderline

public int getUnderline() / public void setUnderline(int value)
Gets or sets the font underline type. The value of the property is FontUnderlineType integer constant.

setUnderline

public void setUnderline(int value)
Gets or sets the font underline type. The value of the property is FontUnderlineType integer constant.

getName/setName

public java.lang.String getName() / public void setName(java.lang.String value)
Gets or sets the name of the Font.

Example:

Font font = style.getFont();
font.setName("Times New Roman");

setName

public void setName(java.lang.String value)
Gets or sets the name of the Font.

Example:

Font font = style.getFont();
font.setName("Times New Roman");

getDoubleSize/setDoubleSize

public double getDoubleSize() / public void setDoubleSize(double value)
Gets and sets the double size of the font.

setDoubleSize

public void setDoubleSize(double value)
Gets and sets the double size of the font.

getSize/setSize

public int getSize() / public void setSize(int value)
Gets or sets the size of the font.

setSize

public void setSize(int value)
Gets or sets the size of the font.

getThemeColor/setThemeColor

public ThemeColor getThemeColor() / public void setThemeColor(ThemeColor value)
Gets and sets the theme color. If the font color is not a theme color, NULL will be returned.

setThemeColor

public void setThemeColor(ThemeColor value)
Gets and sets the theme color. If the font color is not a theme color, NULL will be returned.

getColor/setColor

public com.aspose.cells.Color getColor() / public void setColor(com.aspose.cells.Color value)
Gets or sets the com.aspose.cells.Color of the font.

setColor

public void setColor(com.aspose.cells.Color value)
Gets or sets the com.aspose.cells.Color of the font.

getArgbColor/setArgbColor

public int getArgbColor() / public void setArgbColor(int value)
Gets and sets the color with a 32-bit ARGB value.

setArgbColor

public void setArgbColor(int value)
Gets and sets the color with a 32-bit ARGB value.

isNormalizeHeights/setNormalizeHeights

public boolean isNormalizeHeights() / public void setNormalizeHeights(boolean value)
Indicates whether the normalization of height that is to be applied to the text run.

setNormalizeHeights

public void setNormalizeHeights(boolean value)
Indicates whether the normalization of height that is to be applied to the text run.

getSchemeType/setSchemeType

public int getSchemeType() / public void setSchemeType(int value)
Gets and sets the scheme type of the font. The value of the property is FontSchemeType integer constant.

setSchemeType

public void setSchemeType(int value)
Gets and sets the scheme type of the font. The value of the property is FontSchemeType integer constant.

Method Detail

equals

public boolean equals(Font font)
Checks if two fonts are equals.
Parameters:
font - Compared font object.
Returns:
True if equal to the compared font object.

toString

public java.lang.String toString()
Returns a string represents the current Cell object.
Returns:

See Also:
          Aspose.Cells Documentation - the home page for the Aspose.Cells Product Documentation.
          Aspose.Cells Support Forum - our preferred method of support.





© 2015 - 2024 Weber Informatics LLC | Privacy Policy