[]
        
(Showing Draft Content)

FontInfo

Class FontInfo

java.lang.Object
com.grapecity.documents.excel.FontInfo

public final class FontInfo extends Object
Contains information about a font used in a workbook.

Use this type with APIs such as Workbook.getUsedFonts() to inspect the font name and style attributes used in a workbook.


 FontInfo fontInfo = new FontInfo();
 fontInfo.name = "Arial";
 fontInfo.bold = true;
 fontInfo.italic = false;
 
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    boolean
    Gets or sets whether the font is bold.
    boolean
    Gets or sets whether the font is italic.
    Gets or sets the name of the font.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Checks whether this font information is equal to another object.
    int
    Returns a hash code for this font information.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • name

      public String name
      Gets or sets the name of the font.
      
       FontInfo fontInfo = new FontInfo();
       fontInfo.name = "Arial";
       String fontName = fontInfo.name;
       
    • bold

      public boolean bold
      Gets or sets whether the font is bold.
      
       FontInfo fontInfo = new FontInfo();
       fontInfo.bold = true;
       boolean isBold = fontInfo.bold;
       
    • italic

      public boolean italic
      Gets or sets whether the font is italic.
      
       FontInfo fontInfo = new FontInfo();
       fontInfo.italic = true;
       boolean isItalic = fontInfo.italic;
       
  • Constructor Details

    • FontInfo

      public FontInfo()
  • Method Details

    • equals

      public boolean equals(Object obj)
      Checks whether this font information is equal to another object.

      Two FontInfo objects are considered equal when their name, bold, and italic fields have the same values. This method returns false if obj is not a FontInfo instance or is null.

      
       FontInfo fontInfo = new FontInfo();
       fontInfo.name = "Arial";
       fontInfo.bold = true;
       fontInfo.italic = false;
       FontInfo other = new FontInfo();
       other.name = "Arial";
       other.bold = true;
       other.italic = false;
       boolean isEqual = fontInfo.equals(other);
       
      Overrides:
      equals in class Object
      Parameters:
      obj - The object to compare with this font information. May be null.
      Returns:
      true if the specified object is a FontInfo with the same name, bold, and italic values; otherwise, false.
    • hashCode

      public int hashCode()
      Returns a hash code for this font information.

      The returned value is computed from the name, bold, and italic fields. Font information objects that are equal according to equals(Object) return the same hash code.

      
       FontInfo fontInfo = new FontInfo();
       fontInfo.name = "Arial";
       fontInfo.bold = true;
       fontInfo.italic = false;
       int hashCode = fontInfo.hashCode();
       
      Overrides:
      hashCode in class Object
      Returns:
      A hash code for this instance, suitable for use in hashing algorithms and data structures such as hash tables.