Format Class

Providing the methods and properties that are available for formatting cells in Excel. More...

Header: #include <Format>

Public Types

enum BorderStyle { BorderNone, BorderThin, BorderMedium, BorderDashed, ..., BorderSlantDashDot }
enum DiagonalBorderType { DiagonalBorderNone, DiagonalBorderDown, DiagonalBorderUp, DiagnoalBorderBoth }
enum FillPattern { PatternNone, PatternSolid, PatternMediumGray, PatternDarkGray, ..., PatternLightGrid }
enum FontScript { FontScriptNormal, FontScriptSuper, FontScriptSub }
enum FontUnderline { FontUnderlineNone, FontUnderlineSingle, FontUnderlineDouble, FontUnderlineSingleAccounting, FontUnderlineDoubleAccounting }
enum HorizontalAlignment { AlignHGeneral, AlignLeft, AlignHCenter, AlignRight, ..., AlignHDistributed }
enum VerticalAlignment { AlignTop, AlignVCenter, AlignBottom, AlignVJustify, AlignVDistributed }

Public Functions

Format()
Format(const Format & other)
~Format()
QColor bottomBorderColor() const
BorderStyle bottomBorderStyle() const
QColor diagonalBorderColor() const
BorderStyle diagonalBorderStyle() const
DiagonalBorderType diagonalBorderType() const
FillPattern fillPattern() const
QFont font() const
bool fontBold() const
QColor fontColor() const
bool fontItalic() const
QString fontName() const
bool fontOutline() const
FontScript fontScript() const
int fontSize() const
bool fontStrikeOut() const
FontUnderline fontUnderline() const
bool hidden() const
HorizontalAlignment horizontalAlignment() const
int indent() const
bool isDateTimeFormat() const
bool isEmpty() const
bool isValid() const
QColor leftBorderColor() const
BorderStyle leftBorderStyle() const
bool locked() const
void mergeFormat(const Format & modifier)
QString numberFormat() const
int numberFormatIndex() const
QColor patternBackgroundColor() const
QColor patternForegroundColor() const
QColor rightBorderColor() const
BorderStyle rightBorderStyle() const
int rotation() const
void setBorderColor(const QColor & color)
void setBorderStyle(BorderStyle style)
void setBottomBorderColor(const QColor & color)
void setBottomBorderStyle(BorderStyle style)
void setDiagonalBorderColor(const QColor & color)
void setDiagonalBorderStyle(BorderStyle style)
void setDiagonalBorderType(DiagonalBorderType style)
void setFillPattern(FillPattern pattern)
void setFont(const QFont & font)
void setFontBold(bool bold)
void setFontColor(const QColor & color)
void setFontItalic(bool italic)
void setFontName(const QString & name)
void setFontOutline(bool outline)
void setFontScript(FontScript script)
void setFontSize(int size)
void setFontStrikeOut(bool strikeOut)
void setFontUnderline(FontUnderline underline)
void setHidden(bool hidden)
void setHorizontalAlignment(HorizontalAlignment align)
void setIndent(int indent)
void setLeftBorderColor(const QColor & color)
void setLeftBorderStyle(BorderStyle style)
void setLocked(bool locked)
void setNumberFormat(const QString & format)
void setNumberFormatIndex(int format)
void setPatternBackgroundColor(const QColor & color)
void setPatternForegroundColor(const QColor & color)
void setRightBorderColor(const QColor & color)
void setRightBorderStyle(BorderStyle style)
void setRotation(int rotation)
void setShrinkToFit(bool shink)
void setTextWarp(bool wrap)
void setTopBorderColor(const QColor & color)
void setTopBorderStyle(BorderStyle style)
void setVerticalAlignment(VerticalAlignment align)
bool shrinkToFit() const
bool textWrap() const
QColor topBorderColor() const
BorderStyle topBorderStyle() const
VerticalAlignment verticalAlignment() const
bool operator!=(const Format & format) const
Format & operator=(const Format & other)
bool operator==(const Format & format) const

Detailed Description

Providing the methods and properties that are available for formatting cells in Excel.

Member Type Documentation

enum Format::BorderStyle

* * * The enum type defines the type of font underline. * *

ConstantValueDescription
Format::BorderNone0*
Format::BorderThin1*
Format::BorderMedium2*
Format::BorderDashed3*
Format::BorderDotted4*
Format::BorderThick5*
Format::BorderDouble6*
Format::BorderHair7*
Format::BorderMediumDashed8*
Format::BorderDashDot9*
Format::BorderMediumDashDot10*
Format::BorderDashDotDot11*
Format::BorderMediumDashDotDot12*
Format::BorderSlantDashDot13 

enum Format::DiagonalBorderType

The enum type defines the type of diagonal border.

ConstantValue
Format::DiagonalBorderNone0
Format::DiagonalBorderDown1
Format::DiagonalBorderUp2
Format::DiagnoalBorderBoth3

enum Format::FillPattern

The enum type defines the type of fill.

ConstantValue
Format::PatternNone0
Format::PatternSolid1
Format::PatternMediumGray2
Format::PatternDarkGray3
Format::PatternLightGray4
Format::PatternDarkHorizontal5
Format::PatternDarkVertical6
Format::PatternDarkDown7
Format::PatternDarkUp8
Format::PatternDarkGrid9
Format::PatternDarkTrellis10
Format::PatternLightHorizontal11
Format::PatternLightVertical12
Format::PatternLightDown13
Format::PatternLightUp14
Format::PatternLightTrellis15
Format::PatternGray12516
Format::PatternGray062517
Format::PatternLightGrid18

enum Format::FontScript

The enum type defines the type of font script.

ConstantValueDescription
Format::FontScriptNormal0normal
Format::FontScriptSuper1super script
Format::FontScriptSub2sub script

enum Format::FontUnderline

The enum type defines the type of font underline.

ConstantValue
Format::FontUnderlineNone0
Format::FontUnderlineSingle1
Format::FontUnderlineDouble2
Format::FontUnderlineSingleAccounting3
Format::FontUnderlineDoubleAccounting4

enum Format::HorizontalAlignment

The enum type defines the type of horizontal alignment.

ConstantValue
Format::AlignHGeneral0
Format::AlignLeft1
Format::AlignHCenter2
Format::AlignRight3
Format::AlignHFill4
Format::AlignHJustify5
Format::AlignHMerge6
Format::AlignHDistributed7

enum Format::VerticalAlignment

The enum type defines the type of vertical alignment.

ConstantValueDescription
Format::AlignTop0,
Format::AlignVCenter1,
Format::AlignBottom2,
Format::AlignVJustify3,
Format::AlignVDistributed4 

Member Function Documentation

Format::Format()

Creates a new invalid format.

Format::Format(const Format & other)

Creates a new format with the same attributes as the other format.

Format::~Format()

Destroys this format.

QColor Format::bottomBorderColor() const

Returns the bottom border color.

See also setBottomBorderColor().

BorderStyle Format::bottomBorderStyle() const

Returns the bottom border style.

See also setBottomBorderStyle().

QColor Format::diagonalBorderColor() const

Returns the diagonal border color.

See also setDiagonalBorderColor().

BorderStyle Format::diagonalBorderStyle() const

Return the diagonla border style.

See also setDiagonalBorderStyle().

DiagonalBorderType Format::diagonalBorderType() const

Returns the diagonal border type.

See also setDiagonalBorderType().

FillPattern Format::fillPattern() const

Return the fill pattern.

See also setFillPattern().

QFont Format::font() const

Returns a QFont object based on font data contained in the format.

See also setFont().

bool Format::fontBold() const

Return whether the font is bold.

See also setFontBold().

QColor Format::fontColor() const

Return the color of the font.

See also setFontColor().

bool Format::fontItalic() const

Return whether the font is italic.

See also setFontItalic().

QString Format::fontName() const

Return the name of the font.

See also setFontName().

bool Format::fontOutline() const

Return whether the font is outline.

See also setFontOutline().

FontScript Format::fontScript() const

Return the script style of the font.

See also setFontScript().

int Format::fontSize() const

Return the size of the font in points.

See also setFontSize().

bool Format::fontStrikeOut() const

Return whether the font is strikeout.

See also setFontStrikeOut().

FontUnderline Format::fontUnderline() const

Return the underline style of the font.

See also setFontUnderline().

bool Format::hidden() const

Returns whether the hidden protection property is set to true.

See also setHidden().

HorizontalAlignment Format::horizontalAlignment() const

Return the horizontal alignment.

See also setHorizontalAlignment().

int Format::indent() const

Return the text indentation level.

See also setIndent().

bool Format::isDateTimeFormat() const

Returns whether the number format is probably a dateTime or not

bool Format::isEmpty() const

Returns true if the format is empty; otherwise returns false.

bool Format::isValid() const

Returns true if the format is valid; otherwise returns false.

QColor Format::leftBorderColor() const

Returns the left border color

See also setLeftBorderColor().

BorderStyle Format::leftBorderStyle() const

Returns the left border style

See also setLeftBorderStyle().

bool Format::locked() const

Returns whether the locked protection property is set to true.

See also setLocked().

void Format::mergeFormat(const Format & modifier)

Merges the current format with the properties described by format modifier.

QString Format::numberFormat() const

Returns the number format string.

Note: for built-in number formats, this may return an empty string.

See also setNumberFormat().

int Format::numberFormatIndex() const

Returns the number format identifier.

See also setNumberFormatIndex().

QColor Format::patternBackgroundColor() const

Returns the background color of the pattern.

See also setPatternBackgroundColor().

QColor Format::patternForegroundColor() const

Returns the foreground color of the pattern.

See also setPatternForegroundColor().

QColor Format::rightBorderColor() const

Returns the right border color.

See also setRightBorderColor().

BorderStyle Format::rightBorderStyle() const

Returns the right border style.

See also setRightBorderStyle().

int Format::rotation() const

Return the text rotation.

See also setRotation().

void Format::setBorderColor(const QColor & color)

Sets the border color with the given color.

void Format::setBorderStyle(BorderStyle style)

Set the border style with the given style.

void Format::setBottomBorderColor(const QColor & color)

Sets the bottom border color to the given color.

See also bottomBorderColor().

void Format::setBottomBorderStyle(BorderStyle style)

Sets the bottom border style to the given style.

See also bottomBorderStyle().

void Format::setDiagonalBorderColor(const QColor & color)

Sets the diagonal border color to the given color

See also diagonalBorderColor().

void Format::setDiagonalBorderStyle(BorderStyle style)

Sets the diagonal border style to the given style.

See also diagonalBorderStyle().

void Format::setDiagonalBorderType(DiagonalBorderType style)

Sets the diagonal border type to the given style

See also diagonalBorderType().

void Format::setFillPattern(FillPattern pattern)

Sets the fill pattern to the given pattern.

See also fillPattern().

void Format::setFont(const QFont & font)

Set the format properties from the given font.

See also font().

void Format::setFontBold(bool bold)

Turn on/off the bold font based on the given bold.

See also fontBold().

void Format::setFontColor(const QColor & color)

Set the color of the font.

See also fontColor().

void Format::setFontItalic(bool italic)

Turn on/off the italic font based on italic.

See also fontItalic().

void Format::setFontName(const QString & name)

Set the name of the font to name.

See also fontName().

void Format::setFontOutline(bool outline)

Turn on/off the outline font based on outline.

See also fontOutline().

void Format::setFontScript(FontScript script)

Set the script style of the font to script.

See also fontScript().

void Format::setFontSize(int size)

Set the size of the font in points.

See also fontSize().

void Format::setFontStrikeOut(bool strikeOut)

Turn on/off the strikeOut font based on strikeOut.

See also fontStrikeOut().

void Format::setFontUnderline(FontUnderline underline)

Set the underline style of the font to underline.

See also fontUnderline().

void Format::setHidden(bool hidden)

Sets the hidden protection property with the given hidden.

See also hidden().

void Format::setHorizontalAlignment(HorizontalAlignment align)

Set the horizontal alignment with the given align.

See also horizontalAlignment().

void Format::setIndent(int indent)

Set the text indentation level with the given indent. Must be less than or equal to 15.

See also indent().

void Format::setLeftBorderColor(const QColor & color)

Sets the left border color to the given color

See also leftBorderColor().

void Format::setLeftBorderStyle(BorderStyle style)

Sets the left border style to style

See also leftBorderStyle().

void Format::setLocked(bool locked)

Sets the locked protection property with the given locked.

See also locked().

void Format::setNumberFormat(const QString & format)

Set number format. http://office.microsoft.com/en-001/excel-help/create-a-custom-number-format-HP010342372.aspx

See also numberFormat().

void Format::setNumberFormatIndex(int format)

Set the number format identifier. The format must be a valid built-in number format identifier or the identifier of a custom number format.

See also numberFormatIndex().

void Format::setPatternBackgroundColor(const QColor & color)

Sets the background color of the pattern with the given color.

See also patternBackgroundColor().

void Format::setPatternForegroundColor(const QColor & color)

Sets the foreground color of the pattern with the given color.

See also patternForegroundColor().

void Format::setRightBorderColor(const QColor & color)

Sets the right border color to the given color

See also rightBorderColor().

void Format::setRightBorderStyle(BorderStyle style)

Sets the right border style to the given style.

See also rightBorderStyle().

void Format::setRotation(int rotation)

Set the text roation with the given rotation. Must be in the range [0, 180] or 255.

See also rotation().

void Format::setShrinkToFit(bool shink)

Turn on/off shrink to fit base on shink.

See also shrinkToFit().

void Format::setTextWarp(bool wrap)

Enable the text wrap if wrap is true.

void Format::setTopBorderColor(const QColor & color)

Sets the top border color to the given color.

See also topBorderColor().

void Format::setTopBorderStyle(BorderStyle style)

Sets the top border style to the given style.

See also topBorderStyle().

void Format::setVerticalAlignment(VerticalAlignment align)

Set the vertical alignment with the given align.

See also verticalAlignment().

bool Format::shrinkToFit() const

Return whether the cell is shrink to fit.

See also setShrinkToFit().

bool Format::textWrap() const

Return whether the cell text is wrapped.

QColor Format::topBorderColor() const

Returns the top border color.

See also setTopBorderColor().

BorderStyle Format::topBorderStyle() const

Returns the top border style.

See also setTopBorderStyle().

VerticalAlignment Format::verticalAlignment() const

Return the vertical alignment.

See also setVerticalAlignment().

bool Format::operator!=(const Format & format) const

Returns ture if the format is not equal to this format.

Format & Format::operator=(const Format & other)

Assigns the other format to this format, and returns a reference to this format.

bool Format::operator==(const Format & format) const

Returns ture if the format is equal to this format.