aspose.cells

Class Font

Encapsulates the font object used in a spreadsheet.

Example:

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

Property Getters/Setters Summary
functiongetArgbColor()
function
           Gets and sets the color with a 32-bit ARGB value.
functiongetCapsType()
function
           Gets and sets the text caps type. The value of the property is TextCapsType integer constant.
functiongetCharset()
function
setCharset(value)
           Represent the character set.
functiongetColor()
function
setColor(value)
           Gets or sets the com.aspose.cells.Color of the font.
functiongetDoubleSize()
function
           Gets and sets the double size of the font.
functionisBold()
function
setBold(value)
           Gets or sets a value indicating whether the font is bold.
functionisItalic()
function
setItalic(value)
           Gets or sets a value indicating whether the font is italic.
functionisNormalizeHeights()
function
           Indicates whether the normalization of height that is to be applied to the text run.
functionisStrikeout()
function
           Gets or sets a value indicating whether the font is single strikeout.
functionisSubscript()
function
           Gets or sets a value indicating whether the font is subscript.
functionisSuperscript()
function
           Gets or sets a value indicating whether the font is super script.
functiongetName()
function
setName(value)
           Gets or sets the name of the Font.
functiongetSchemeType()
function
           Gets and set sthe scheme type of the font. The value of the property is FontSchemeType integer constant.
functiongetScriptOffset()
function
           Gets and sets the sript offset,in unit of percentage
functiongetSize()
function
setSize(value)
           Gets or sets the size of the font.
functiongetStrikeType()
function
           Gets the strike type of the text. The value of the property is TextStrikeType integer constant.
functiongetThemeColor()
function
           Gets and sets the theme color.
functiongetUnderline()
function
           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 sript 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:

        var 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 set sthe 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: