Home Index Book Sheet Format Font AutoFilter FilterColumn RichString FormControl
ConditionalFormatting ConditionalFormat CoreProperties Examples
ConditionalFormatting ConditionalFormat CoreProperties Examples
Format class reference
-
Font* font() const Returns the pointer to the current font. Returns NULL if error occurs. Get an error info with the Book::errorMessage().
-
bool setFont(Font* font) Sets the font for the format. To create a new font use Book::addFont(). Returns false if error occurs. Get an error info with the Book::errorMessage().
-
int numFormat() const Returns the number format identifier.
-
void setNumFormat(int numFormat) Sets the number format identifier. The identifier must be a valid built-in number format identifier or the identifier of a custom number format. To create a custom format use Book::addCustomNumFormat(). See built-in values in the following table:
Constant Description Example NUMFORMAT_GENERAL general format NUMFORMAT_NUMBER general number 1000 NUMFORMAT_NUMBER_D2 number with decimal point 1000.00 NUMFORMAT_NUMBER_SEP number with thousands separator 100,000 NUMFORMAT_NUMBER_SEP_D2 number with decimal point and thousands separator 100,000.00 NUMFORMAT_CURRENCY_NEGBRA monetary value, negative in brackets (1000$) NUMFORMAT_CURRENCY_NEGBRARED monetary value, negative is red in brackets (1000$) NUMFORMAT_CURRENCY_D2_NEGBRA monetary value with decimal point, negative in brackets ($1000.00) NUMFORMAT_CURRENCY_D2_NEGBRARED monetary value with decimal point, negative is red in brackets ($1000.00) NUMFORMAT_PERCENT percent value, multiply the cell value by 100 75% NUMFORMAT_PERCENT_D2 percent value with decimal point, multiply the cell value by 100 75.00% NUMFORMAT_SCIENTIFIC_D2 scientific value with E character and decimal point 10.00E+1 NUMFORMAT_FRACTION_ONEDIG fraction value, one digit 10 1/2 NUMFORMAT_FRACTION_TWODIG fraction value, two digits 10 23/95 NUMFORMAT_DATE date value, depends on OS settings 3/11/2009 NUMFORMAT_CUSTOM_D_MON_YY custom date value 11-Mar-09 NUMFORMAT_CUSTOM_D_MON custom date value 11-Mar NUMFORMAT_CUSTOM_MON_YY custom date value Mar-09 NUMFORMAT_CUSTOM_HMM_AM custom date value 8:30 AM NUMFORMAT_CUSTOM_HMMSS_AM custom date value 8:30:00 AM NUMFORMAT_CUSTOM_HMM custom date value 8:30 NUMFORMAT_CUSTOM_HMMSS custom date value 8:30:00 NUMFORMAT_CUSTOM_MDYYYY_HMM custom datetime value 3/11/2009 8:30 NUMFORMAT_NUMBER_SEP_NEGBRA number with thousands separator, negative in brackets (4,000) NUMFORMAT_NUMBER_SEP_NEGBRARED number with thousands separator, negative is red in brackets (4,000) NUMFORMAT_NUMBER_D2_SEP_NEGBRA number with thousands separator and decimal point, negative in brackets (4,000.00) NUMFORMAT_NUMBER_D2_SEP_NEGBRARED number with thousands separator and decimal point, negative is red in brackets (4,000.00) NUMFORMAT_ACCOUNT account value 5,000 NUMFORMAT_ACCOUNTCUR account value with currency symbol $ 5,000 NUMFORMAT_ACCOUNT_D2 account value with decimal point 5,000.00 NUMFORMAT_ACCOUNT_D2_CUR account value with currency symbol and decimal point $ 5,000.00 NUMFORMAT_CUSTOM_MMSS custom time value 30:55 NUMFORMAT_CUSTOM_H0MMSS custom time value 20:30:55 NUMFORMAT_CUSTOM_MMSS0 custom time value 30:55.0 NUMFORMAT_CUSTOM_000P0E_PLUS0 custom value 15.2E+3 NUMFORMAT_TEXT text value any text -
AlignH alignH() const Returns the horizontal alignment.
-
void setAlignH(AlignH align) Sets the horizontal alignment.
AlignH value View ALIGNH_GENERAL ALIGNH_LEFT ALIGNH_CENTER ALIGNH_RIGHT ALIGNH_FILL ALIGNH_JUSTIFY ALIGNH_MERGE ALIGNH_DISTRIBUTED -
AlignV alignV() const Returns the vertical alignment.
-
void setAlignV(AlignV align) Sets the vertical alignment.
AlignV value View ALIGNV_TOP ALIGNV_CENTER ALIGNV_BOTTOM ALIGNV_JUSTIFY ALIGNV_DISTRIBUTED -
bool wrap() const Returns whether the cell text is wrapped.
-
void setWrap(bool wrap = true) Sets the flag whether the cell text is wrapped.
-
int rotation() const Returns the text rotation.
-
bool setRotation(int rotation) Sets the text rotation. Must be a value from the following table:
Value Meaning 0 - 90 Text rotated counterclockwise 0 to 90 degrees 91 - 180 Text rotated clockwise 1 to 90 degrees 255 Vertical text -
int indent() const Returns the text indentation level.
-
void setIndent(int indent) Sets the text indentation level. Must be less than or equal to 15.
-
bool shrinkToFit() const Returns whether the cell is shrink-to-fit.
-
void setShrinkToFit(bool shrinkToFit = true) Sets the flag whether the cell is shrink-to-fit.
-
void setBorder(BorderStyle style = BORDERSTYLE_THIN) Sets the border style.
BorderStyle value View BORDERSTYLE_NONE BORDERSTYLE_THIN BORDERSTYLE_MEDIUM BORDERSTYLE_DASHED BORDERSTYLE_DOTTED BORDERSTYLE_THICK BORDERSTYLE_DOUBLE BORDERSTYLE_HAIR BORDERSTYLE_MEDIUMDASHED BORDERSTYLE_DASHDOT BORDERSTYLE_MEDIUMDASHDOT BORDERSTYLE_DASHDOTDOT BORDERSTYLE_MEDIUMDASHDOTDOT BORDERSTYLE_SLANTDASHDOT -
void setBorderColor(Color color) Sets the border color.
-
BorderStyle borderLeft() const Returns the left border style.
-
void setBorderLeft(BorderStyle style = BORDERSTYLE_THIN) Sets the left border style.
-
BorderStyle borderRight() const Returns the right border style.
-
void setBorderRight(BorderStyle style = BORDERSTYLE_THIN) Sets the right border style.
-
BorderStyle borderTop() const Returns the top border style.
-
void setBorderTop(BorderStyle style = BORDERSTYLE_THIN) Sets the top border style.
-
BorderStyle borderBottom() const Returns the bottom border style.
-
void setBorderBottom(BorderStyle style = BORDERSTYLE_THIN) Sets the bottom border style.
-
Color borderLeftColor() const Returns the color of the left border.
-
void setBorderLeftColor(Color color) Sets the color of the left border.
-
Color borderRightColor() const Returns the color of the right border.
-
void setBorderRightColor(Color color) Sets the color of the right border.
-
Color borderTopColor() const Returns the color of the top border.
-
void setBorderTopColor(Color color) Sets the color of the top border.
-
Color borderBottomColor() const Returns the color of the bottom border.
-
void setBorderBottomColor(Color color) Sets the color of the bottom border.
-
BorderDiagonal borderDiagonal() const Returns the diagonal border.
- void setBorderDiagonal(BorderDiagonal border)
-
BorderStyle borderDiagonalStyle() const Returns the style of the diagonal border.
-
void setBorderDiagonalStyle(BorderStyle style) Sets the style of the diagonal border.
-
Color borderDiagonalColor() const Returns the color of the diagonal border.
-
void setBorderDiagonalColor(Color color) Sets the color of the diagonal border.
-
FillPattern fillPattern() const Returns the fill pattern.
-
void setFillPattern(FillPattern pattern) Sets the fill pattern.
FillPattern value View FILLPATTERN_NONE FILLPATTERN_SOLID FILLPATTERN_GRAY50 FILLPATTERN_GRAY75 FILLPATTERN_GRAY25 FILLPATTERN_HORSTRIPE FILLPATTERN_VERSTRIPE FILLPATTERN_REVDIAGSTRIPE FILLPATTERN_DIAGSTRIPE FILLPATTERN_DIAGCROSSHATCH FILLPATTERN_THICKDIAGCROSSHATCH FILLPATTERN_THINHORSTRIPE FILLPATTERN_THINVERSTRIPE FILLPATTERN_THINREVDIAGSTRIPE FILLPATTERN_THINDIAGSTRIPE FILLPATTERN_THINHORCROSSHATCH FILLPATTERN_THINDIAGCROSSHATCH FILLPATTERN_GRAY12P5 FILLPATTERN_GRAY6P25 -
Color patternForegroundColor() const Returns the foreground color of the fill pattern.
-
void setPatternForegroundColor(Color color) Sets the foreground color of the fill pattern.
-
Color patternBackgroundColor() const Returns the background color of the fill pattern.
-
void setPatternBackgroundColor(Color color) Sets the background color of the fill pattern.
-
bool locked() const Returns whether the locked protection property is set to true.
-
void setLocked(bool locked = true) Sets 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. -
bool hidden() const Returns whether the hidden protection property is set to true.
-
void setHidden(bool hidden = true) Sets the hidden protection property.