aspose.cells
Class Font

Encapsulates the font object used in a spreadsheet.

Example:

//Instantiating a Workbook object
//Instantiating a Workbook object
$workbook = new cells\Workbook();
//Obtaining the reference of the newly added worksheet by passing its sheet index
$worksheet = $workbook->getWorksheets()->get(0);
//Accessing the "A1" cell from the worksheet
$cell = $worksheet->getCells()->get("A1");
//Adding some value to the "A1" cell
$cell->putValue("Hello Aspose!");
$style = $cell->getStyle();
$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(cells\Color::getRed());
$cell->setStyle($style);

Property Getters/Setters Summary
functiongetArgbColor()
functionsetArgbColor(value)
           Gets and sets the color with a 32-bit ARGB value.
functiongetCapsType()
functionsetCapsType(value)
           Gets and sets the text caps type. The value of the property is TextCapsType integer constant.
functiongetCharset()
functionsetCharset(value)
           Represent the character set.
functiongetColor()
functionsetColor(value)
           Gets or sets the com.aspose.cells.Color of the font.
functiongetDoubleSize()
functionsetDoubleSize(value)
           Gets and sets the double size of the font.
functionisBold()
functionsetBold(value)
           Gets or sets a value indicating whether the font is bold.
functionisItalic()
functionsetItalic(value)
           Gets or sets a value indicating whether the font is italic.
functionisNormalizeHeights()
functionsetNormalizeHeights(value)
           Indicates whether the normalization of height that is to be applied to the text run.
functionisStrikeout()
functionsetStrikeout(value)
           Gets or sets a value indicating whether the font is single strikeout.
functionisSubscript()
functionsetSubscript(value)
           Gets or sets a value indicating whether the font is subscript.
functionisSuperscript()
functionsetSuperscript(value)
           Gets or sets a value indicating whether the font is super script.
functiongetName()
functionsetName(value)
           Gets or sets the name of the Font.
functiongetSchemeType()
functionsetSchemeType(value)
           Gets and sets the scheme type of the font. The value of the property is FontSchemeType integer constant.
functiongetScriptOffset()
functionsetScriptOffset(value)
           Gets and sets the script offset,in unit of percentage
functiongetSize()
functionsetSize(value)
           Gets or sets the size of the font.
functiongetStrikeType()
functionsetStrikeType(value)
           Gets the strike type of the text. The value of the property is TextStrikeType integer constant.
functiongetThemeColor()
functionsetThemeColor(value)
           Gets and sets the theme color.
functiongetUnderline()
functionsetUnderline(value)
           Gets or sets the font underline type. The value of the property is FontUnderlineType integer constant.
 
Method Summary
functionequals(font)
           Checks if two fonts are equals.
functiontoString()
           Returns a string represents the current Cell object.
 

Property Getters/Setters Detail

getCharset/setCharset : Number 

function getCharset() / function setCharset(value)
Represent the character set.

isItalic/setItalic : boolean 

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

isBold/setBold : boolean 

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

getCapsType/setCapsType : Number 

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

getStrikeType/setStrikeType : Number 

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

isStrikeout/setStrikeout : boolean 

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

getScriptOffset/setScriptOffset : Number 

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

isSuperscript/setSuperscript : boolean 

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

isSubscript/setSubscript : boolean 

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

getUnderline/setUnderline : Number 

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

getName/setName : String 

function getName() / function setName(value)
Gets or sets the name of the Font.

Example:

$workbook = new cells\Workbook();
//Obtaining the reference of the newly added worksheet by passing its sheet index
$worksheet = $workbook->getWorksheets()->get(0);
//Accessing the "A1" cell from the worksheet
$cell = $worksheet->getCells()->get("A1");
//Adding some value to the "A1" cell
$cell->putValue("Hello Aspose!");
$style = $cell->getStyle();
$font = $style->getFont();
$font->setName("Times New Roman");
$cell->setStyle($style);

getDoubleSize/setDoubleSize : Number 

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

getSize/setSize : Number 

function getSize() / function setSize(value)
Gets or sets the size of the font.

getThemeColor/setThemeColor : ThemeColor 

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

getColor/setColor : Color 

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

getArgbColor/setArgbColor : Number 

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

isNormalizeHeights/setNormalizeHeights : boolean 

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

getSchemeType/setSchemeType : Number 

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

Method Detail

equals

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

toString

function toString()
Returns a string represents the current Cell object.
Returns:

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