asposecells.api

Encapsulates the font object used in a spreadsheet.

Example:

# Instantiating a Workbook object
workbook = 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(Color.getRed())
cell.setStyle(style)
# Saving the Excel file
workbook.save("Book1.xls")

Property Getters/Setters Summary
methodgetArgbColor()
method
           Gets and sets the color with a 32-bit ARGB value.
methodgetCapsType()
method
           Gets and sets the text caps type. The value of the property is TextCapsType integer constant.
methodgetCharset()
method
setCharset(value)
           Represent the character set.
methodgetColor()
method
setColor(value)
           Gets or sets the com.aspose.cells.Color of the font.
methodgetDoubleSize()
method
           Gets and sets the double size of the font.
methodisBold()
method
setBold(value)
           Gets or sets a value indicating whether the font is bold.
methodisItalic()
method
setItalic(value)
           Gets or sets a value indicating whether the font is italic.
methodisNormalizeHeights()
method
           Indicates whether the normalization of height that is to be applied to the text run.
methodisStrikeout()
method
           Gets or sets a value indicating whether the font is single strikeout.
methodisSubscript()
method
           Gets or sets a value indicating whether the font is subscript.
methodisSuperscript()
method
           Gets or sets a value indicating whether the font is super script.
methodgetName()
method
setName(value)
           Gets or sets the name of the Font.
methodgetSchemeType()
method
           Gets and sets the scheme type of the font. The value of the property is FontSchemeType integer constant.
methodgetScriptOffset()
method
           Gets and sets the script offset,in unit of percentage
methodgetSize()
method
setSize(value)
           Gets or sets the size of the font.
methodgetStrikeType()
method
           Gets the strike type of the text. The value of the property is TextStrikeType integer constant.
methodgetThemeColor()
method
           Gets and sets the theme color.
methodgetUnderline()
method
           Gets or sets the font underline type. The value of the property is FontUnderlineType integer constant.
 
Method Summary
methodequals(font)
Checks if two fonts are equals.
methodtoString()
Returns a string represents the current Cell object.
 

    • Property Getters/Setters Detail

      • getCharset/setCharset : int 

        int getCharset() / setCharset(value)
        
        Represent the character set.
      • isItalic/setItalic : boolean 

        boolean isItalic() / setItalic(value)
        
        Gets or sets a value indicating whether the font is italic.
      • isBold/setBold : boolean 

        boolean isBold() / setBold(value)
        
        Gets or sets a value indicating whether the font is bold.
      • getCapsType/setCapsType : int 

        int getCapsType() / setCapsType(value)
        
        Gets and sets the text caps type. The value of the property is TextCapsType integer constant.
      • getStrikeType/setStrikeType : int 

        int getStrikeType() / setStrikeType(value)
        
        Gets the strike type of the text. The value of the property is TextStrikeType integer constant.
      • isStrikeout/setStrikeout : boolean 

        boolean isStrikeout() / setStrikeout(value)
        
        Gets or sets a value indicating whether the font is single strikeout.
      • getScriptOffset/setScriptOffset : float 

        float getScriptOffset() / setScriptOffset(value)
        
        Gets and sets the script offset,in unit of percentage
      • isSuperscript/setSuperscript : boolean 

        boolean isSuperscript() / setSuperscript(value)
        
        Gets or sets a value indicating whether the font is super script.
      • isSubscript/setSubscript : boolean 

        boolean isSubscript() / setSubscript(value)
        
        Gets or sets a value indicating whether the font is subscript.
      • getUnderline/setUnderline : int 

        int getUnderline() / setUnderline(value)
        
        Gets or sets the font underline type. The value of the property is FontUnderlineType integer constant.
      • getName/setName : String 

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

        Example:

        workbook = 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 : float 

        float getDoubleSize() / setDoubleSize(value)
        
        Gets and sets the double size of the font.
      • getSize/setSize : int 

        int getSize() / setSize(value)
        
        Gets or sets the size of the font.
      • getThemeColor/setThemeColor : ThemeColor 

        ThemeColor getThemeColor() / setThemeColor(value)
        
        Gets and sets the theme color. If the font color is not a theme color, NULL will be returned.
      • getColor/setColor : Color 

        Color getColor() / setColor(value)
        
        Gets or sets the com.aspose.cells.Color of the font.
      • getArgbColor/setArgbColor : int 

        int getArgbColor() / setArgbColor(value)
        
        Gets and sets the color with a 32-bit ARGB value.
      • isNormalizeHeights/setNormalizeHeights : boolean 

        boolean isNormalizeHeights() / setNormalizeHeights(value)
        
        Indicates whether the normalization of height that is to be applied to the text run.
      • getSchemeType/setSchemeType : int 

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

      • equals

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

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