Format class reference

  • public Font font
    The current font.
  • public int numFormat()
    Returns the number format identifier.
  • public void setNumFormat(NumFormat numFormat)
    Sets the built-in number format identifier.
    ConstantDescriptionExample
    NUMFORMAT_GENERALgeneral format
    NUMFORMAT_NUMBERgeneral number1000
    NUMFORMAT_NUMBER_D2number with decimal point1000.00
    NUMFORMAT_NUMBER_SEPnumber with thousands separator100,000
    NUMFORMAT_NUMBER_SEP_D2number with decimal point and thousands separator100,000.00
    NUMFORMAT_CURRENCY_NEGBRAmonetary value, negative in brackets(1000$)
    NUMFORMAT_CURRENCY_NEGBRAREDmonetary value, negative is red in brackets(1000$)
    NUMFORMAT_CURRENCY_D2_NEGBRAmonetary value with decimal point, negative in brackets($1000.00)
    NUMFORMAT_CURRENCY_D2_NEGBRAREDmonetary value with decimal point, negative is red in brackets($1000.00)
    NUMFORMAT_PERCENTpercent value, multiply the cell value by 10075%
    NUMFORMAT_PERCENT_D2percent value with decimal point, multiply the cell value by 10075.00%
    NUMFORMAT_SCIENTIFIC_D2scientific value with E character and decimal point10.00E+1
    NUMFORMAT_FRACTION_ONEDIGfraction value, one digit10 1/2
    NUMFORMAT_FRACTION_TWODIGfraction value, two digits10 23/95
    NUMFORMAT_DATEdate value, depends on OS settings3/11/2009
    NUMFORMAT_CUSTOM_D_MON_YYcustom date value11-Mar-09
    NUMFORMAT_CUSTOM_D_MONcustom date value11-Mar
    NUMFORMAT_CUSTOM_MON_YYcustom date valueMar-09
    NUMFORMAT_CUSTOM_HMM_AMcustom date value8:30 AM
    NUMFORMAT_CUSTOM_HMMSS_AMcustom date value8:30:00 AM
    NUMFORMAT_CUSTOM_HMMcustom date value8:30
    NUMFORMAT_CUSTOM_HMMSScustom date value8:30:00
    NUMFORMAT_CUSTOM_MDYYYY_HMMcustom datetime value3/11/2009 8:30
    NUMFORMAT_NUMBER_SEP_NEGBRAnumber with thousands separator, negative in brackets(4,000)
    NUMFORMAT_NUMBER_SEP_NEGBRAREDnumber with thousands separator, negative is red in brackets(4,000)
    NUMFORMAT_NUMBER_D2_SEP_NEGBRAnumber with thousands separator and decimal point, negative in brackets(4,000.00)
    NUMFORMAT_NUMBER_D2_SEP_NEGBRAREDnumber with thousands separator and decimal point, negative is red in brackets(4,000.00)
    NUMFORMAT_ACCOUNTaccount value5,000
    NUMFORMAT_ACCOUNTCURaccount value with currency symbol
    $5,000
    NUMFORMAT_ACCOUNT_D2account value with decimal point5,000.00
    NUMFORMAT_ACCOUNT_D2_CURaccount value with currency symbol and decimal point
    $5,000.00
    NUMFORMAT_CUSTOM_MMSScustom time value30:55
    NUMFORMAT_CUSTOM_H0MMSScustom time value20:30:55
    NUMFORMAT_CUSTOM_MMSS0custom time value30:55.0
    NUMFORMAT_CUSTOM_000P0E_PLUS0custom value15.2E+3
    NUMFORMAT_TEXTtext valueany text
  • public void setNumFormat(int numFormat)
    Sets the custom number format identifier. To create a custom format use Book::addCustomNumFormat().
  • public AlignH alignH
    The horizontal alignment.
    AlignH valueView
    ALIGNH_GENERALALIGNH_GENERAL
    ALIGNH_LEFTALIGNH_LEFT
    ALIGNH_CENTERALIGNH_CENTER
    ALIGNH_RIGHTALIGNH_RIGHT
    ALIGNH_FILLALIGNH_FILL
    ALIGNH_JUSTIFYALIGNH_JUSTIFY
    ALIGNH_MERGEALIGNH_MERGE
    ALIGNH_DISTRIBUTEDALIGNH_DISTRIBUTED
  • public AlignV alignV
    The vertical alignment.
    AlignV valueView
    ALIGNV_TOPALIGNV_TOP
    ALIGNV_CENTERALIGNV_CENTER
    ALIGNV_BOTTOMALIGNV_BOTTOM
    ALIGNV_JUSTIFYALIGNV_JUSTIFY
    ALIGNV_DISTRIBUTEDALIGNV_DISTRIBUTED
  • public bool wrap
    If true then the cell text is wrapped.
  • public int rotation
    The text rotation.
    ValueMeaning
    0 - 90Text rotated counterclockwise 0 to 90 degrees
    91 - 180Text rotated clockwise 1 to 90 degrees
    255Vertical text
  • public int indent
    The text indentation level. Must be less than or equal to 15.
  • public bool shrinkToFit
    If true then the cell is shrink-to-fit.
  • public void setBorder(BorderStyle style)
    Sets the border style.
    BorderStyle valueView
    BORDERSTYLE_NONEBORDERSTYLE_NONE
    BORDERSTYLE_THINBORDERSTYLE_THIN
    BORDERSTYLE_MEDIUMBORDERSTYLE_MEDIUM
    BORDERSTYLE_DASHEDBORDERSTYLE_DASHED
    BORDERSTYLE_DOTTEDBORDERSTYLE_DOTTED
    BORDERSTYLE_THICKBORDERSTYLE_THICK
    BORDERSTYLE_DOUBLEBORDERSTYLE_DOUBLE
    BORDERSTYLE_HAIRBORDERSTYLE_HAIR
    BORDERSTYLE_MEDIUMDASHEDBORDERSTYLE_MEDIUMDASHED
    BORDERSTYLE_DASHDOTBORDERSTYLE_DASHDOT
    BORDERSTYLE_MEDIUMDASHDOTBORDERSTYLE_MEDIUMDASHDOT
    BORDERSTYLE_DASHDOTDOTBORDERSTYLE_DASHDOTDOT
    BORDERSTYLE_MEDIUMDASHDOTDOTBORDERSTYLE_MEDIUMDASHDOTDOT
    BORDERSTYLE_SLANTDASHDOTBORDERSTYLE_SLANTDASHDOT
  • public void setBorderColor(Color color)
    Sets the border color.
  • public BorderStyle borderLeft
    The left border style.
  • public BorderStyle borderRight
    The right border style.
  • public BorderStyle borderTop
    The top border style.
  • public BorderStyle borderBottom
    The bottom border style.
  • public Color borderLeftColor
    The color of the left border.
  • public Color borderRightColor
    The color of the right border.
  • public Color borderTopColor
    The color of the top border.
  • public Color borderBottomColor
    The color of the bottom border.
  • public BorderDiagonal borderDiagonal
    The diagonal border.
    BorderDiagonal valueView
    BORDERDIAGONAL_NONEBORDERDIAGONAL_NONE
    BORDERDIAGONAL_DOWNBORDERDIAGONAL_DOWN
    BORDERDIAGONAL_UPBORDERDIAGONAL_UP
    BORDERDIAGONAL_BOTHBORDERDIAGONAL_BOTH
  • public BorderStyle borderDiagonalStyle
    The style of the diagonal border.
  • public Color borderDiagonalColor
    The color of the diagonal border.
  • public FillPattern fillPattern
    The fill pattern.
    FillPattern valueView
    FILLPATTERN_NONE
    FILLPATTERN_SOLIDFILLPATTERN_SOLID
    FILLPATTERN_GRAY50FILLPATTERN_GRAY50
    FILLPATTERN_GRAY75FILLPATTERN_GRAY75
    FILLPATTERN_GRAY25FILLPATTERN_GRAY25
    FILLPATTERN_HORSTRIPEFILLPATTERN_HORSTRIPE
    FILLPATTERN_VERSTRIPEFILLPATTERN_VERSTRIPE
    FILLPATTERN_REVDIAGSTRIPEFILLPATTERN_REVDIAGSTRIPE
    FILLPATTERN_DIAGSTRIPEFILLPATTERN_DIAGSTRIPE
    FILLPATTERN_DIAGCROSSHATCHFILLPATTERN_DIAGCROSSHATCH
    FILLPATTERN_THICKDIAGCROSSHATCHFILLPATTERN_THICKDIAGCROSSHATCH
    FILLPATTERN_THINHORSTRIPEFILLPATTERN_THINHORSTRIPE
    FILLPATTERN_THINVERSTRIPEFILLPATTERN_THINVERSTRIPE
    FILLPATTERN_THINREVDIAGSTRIPEFILLPATTERN_THINREVDIAGSTRIPE
    FILLPATTERN_THINDIAGSTRIPEFILLPATTERN_THINDIAGSTRIPE
    FILLPATTERN_THINHORCROSSHATCHFILLPATTERN_THINHORCROSSHATCH
    FILLPATTERN_THINDIAGCROSSHATCHFILLPATTERN_THINDIAGCROSSHATCH
    FILLPATTERN_GRAY12P5FILLPATTERN_GRAY12P5
    FILLPATTERN_GRAY6P25FILLPATTERN_GRAY6P25
  • public Color patternForegroundColor
    The foreground color of the fill pattern.
  • public Color patternBackgroundColor
    The background color of the fill pattern.
  • public bool locked
    The locked protection property. It is used when the sheet is protected with the Sheet::setProtect() method.
    If "locked" is false a user can change a cell with such format even if the sheet is protected.
  • public bool hidden
    The hidden protection property.