xlnt
Public Member Functions | Friends | List of all members
xlnt::format Class Reference

Describes the formatting of a particular cell. More...

#include <format.hpp>

Public Member Functions

class alignment alignment () const
 Returns the alignment of this format. More...
 
format alignment (const xlnt::alignment &new_alignment, xlnt::optional< bool > applied={})
 Sets the alignment of this format to new_alignment. Applied, which defaults to true, determines whether the alignment should be enabled for cells using this format. More...
 
bool alignment_applied () const
 Returns true if the alignment of this format should be applied to cells using it. More...
 
class border border () const
 Returns the border of this format. More...
 
format border (const xlnt::border &new_border, xlnt::optional< bool > applied={})
 Sets the border of this format to new_border. Applied, which defaults to true, determines whether the border should be enabled for cells using this format. More...
 
bool border_applied () const
 Returns true if the border set for this format should be applied to cells using the format. More...
 
class fill fill () const
 Returns the fill of this format. More...
 
format fill (const xlnt::fill &new_fill, xlnt::optional< bool > applied={})
 Sets the fill of this format to new_fill. Applied, which defaults to true, determines whether the border should be enabled for cells using this format. More...
 
bool fill_applied () const
 Returns true if the fill set for this format should be applied to cells using the format. More...
 
class font font () const
 Returns the font of this format. More...
 
format font (const xlnt::font &new_font, xlnt::optional< bool > applied={})
 Sets the font of this format to new_font. Applied, which defaults to true, determines whether the font should be enabled for cells using this format. More...
 
bool font_applied () const
 Returns true if the font set for this format should be applied to cells using the format. More...
 
class number_format number_format () const
 Returns the number format of this format. More...
 
format number_format (const xlnt::number_format &new_number_format, xlnt::optional< bool > applied={})
 Sets the number format of this format to new_number_format. Applied, which defaults to true, determines whether the number format should be enabled for cells using this format. More...
 
bool number_format_applied () const
 Returns true if the number_format set for this format should be applied to cells using the format. More...
 
class protection protection () const
 Returns the protection of this format. More...
 
bool protection_applied () const
 Returns true if the protection set for this format should be applied to cells using the format. More...
 
format protection (const xlnt::protection &new_protection, xlnt::optional< bool > applied={})
 Sets the protection of this format to new_protection. Applied, which defaults to true, determines whether the protection should be enabled for cells using this format. More...
 
bool pivot_button () const
 Returns true if the pivot table interface is enabled for this format. More...
 
void pivot_button (bool show)
 If show is true, a pivot table interface will be displayed for cells using this format. More...
 
bool quote_prefix () const
 Returns true if this format should add a single-quote prefix for all text values. More...
 
void quote_prefix (bool quote)
 If quote is true, enables a single-quote prefix for all text values in cells using this format (e.g. "abc" will appear as "'abc"). The text will also not be stored in sharedStrings when this is enabled. More...
 
bool has_style () const
 Returns true if this format has a corresponding style applied. More...
 
void clear_style ()
 Removes the style from this format if it exists. More...
 
format style (const std::string &name)
 Sets the style of this format to a style with the given name. More...
 
format style (const class style &new_style)
 Sets the style of this format to new_style. More...
 
class style style ()
 Returns the style of this format. If it has no style, an invalid_parameter exception will be thrown. More...
 
const class style style () const
 Returns the style of this format. If it has no style, an invalid_parameters exception will be thrown. More...
 

Friends

struct detail::stylesheet
 
class detail::xlsx_producer
 
class detail::xlsx_consumer
 
class cell
 

Detailed Description

Describes the formatting of a particular cell.

Member Function Documentation

◆ alignment() [1/2]

format xlnt::format::alignment ( const xlnt::alignment new_alignment,
xlnt::optional< bool >  applied = {} 
)

Sets the alignment of this format to new_alignment. Applied, which defaults to true, determines whether the alignment should be enabled for cells using this format.

◆ alignment() [2/2]

class alignment xlnt::format::alignment ( ) const

Returns the alignment of this format.

◆ alignment_applied()

bool xlnt::format::alignment_applied ( ) const

Returns true if the alignment of this format should be applied to cells using it.

◆ border() [1/2]

class border xlnt::format::border ( ) const

Returns the border of this format.

◆ border() [2/2]

format xlnt::format::border ( const xlnt::border new_border,
xlnt::optional< bool >  applied = {} 
)

Sets the border of this format to new_border. Applied, which defaults to true, determines whether the border should be enabled for cells using this format.

◆ border_applied()

bool xlnt::format::border_applied ( ) const

Returns true if the border set for this format should be applied to cells using the format.

◆ clear_style()

void xlnt::format::clear_style ( )

Removes the style from this format if it exists.

◆ fill() [1/2]

class fill xlnt::format::fill ( ) const

Returns the fill of this format.

◆ fill() [2/2]

format xlnt::format::fill ( const xlnt::fill new_fill,
xlnt::optional< bool >  applied = {} 
)

Sets the fill of this format to new_fill. Applied, which defaults to true, determines whether the border should be enabled for cells using this format.

◆ fill_applied()

bool xlnt::format::fill_applied ( ) const

Returns true if the fill set for this format should be applied to cells using the format.

◆ font() [1/2]

class font xlnt::format::font ( ) const

Returns the font of this format.

◆ font() [2/2]

format xlnt::format::font ( const xlnt::font new_font,
xlnt::optional< bool >  applied = {} 
)

Sets the font of this format to new_font. Applied, which defaults to true, determines whether the font should be enabled for cells using this format.

◆ font_applied()

bool xlnt::format::font_applied ( ) const

Returns true if the font set for this format should be applied to cells using the format.

◆ has_style()

bool xlnt::format::has_style ( ) const

Returns true if this format has a corresponding style applied.

◆ number_format() [1/2]

class number_format xlnt::format::number_format ( ) const

Returns the number format of this format.

◆ number_format() [2/2]

format xlnt::format::number_format ( const xlnt::number_format new_number_format,
xlnt::optional< bool >  applied = {} 
)

Sets the number format of this format to new_number_format. Applied, which defaults to true, determines whether the number format should be enabled for cells using this format.

◆ number_format_applied()

bool xlnt::format::number_format_applied ( ) const

Returns true if the number_format set for this format should be applied to cells using the format.

◆ pivot_button() [1/2]

bool xlnt::format::pivot_button ( ) const

Returns true if the pivot table interface is enabled for this format.

◆ pivot_button() [2/2]

void xlnt::format::pivot_button ( bool  show)

If show is true, a pivot table interface will be displayed for cells using this format.

◆ protection() [1/2]

class protection xlnt::format::protection ( ) const

Returns the protection of this format.

◆ protection() [2/2]

format xlnt::format::protection ( const xlnt::protection new_protection,
xlnt::optional< bool >  applied = {} 
)

Sets the protection of this format to new_protection. Applied, which defaults to true, determines whether the protection should be enabled for cells using this format.

◆ protection_applied()

bool xlnt::format::protection_applied ( ) const

Returns true if the protection set for this format should be applied to cells using the format.

◆ quote_prefix() [1/2]

bool xlnt::format::quote_prefix ( ) const

Returns true if this format should add a single-quote prefix for all text values.

◆ quote_prefix() [2/2]

void xlnt::format::quote_prefix ( bool  quote)

If quote is true, enables a single-quote prefix for all text values in cells using this format (e.g. "abc" will appear as "'abc"). The text will also not be stored in sharedStrings when this is enabled.

◆ style() [1/4]

format xlnt::format::style ( const std::string &  name)

Sets the style of this format to a style with the given name.

◆ style() [2/4]

format xlnt::format::style ( const class style new_style)

Sets the style of this format to new_style.

◆ style() [3/4]

const class style xlnt::format::style ( ) const

Returns the style of this format. If it has no style, an invalid_parameters exception will be thrown.

◆ style() [4/4]

class style xlnt::format::style ( )

Returns the style of this format. If it has no style, an invalid_parameter exception will be thrown.


The documentation for this class was generated from the following file: