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

Describes a style which has a name and can be applied to multiple individual formats. In Excel this is a "Cell Style". More...

#include <style.hpp>

Public Member Functions

 style ()=delete
 Delete zero-argument constructor More...
 
 style (const style &other)=default
 Default copy constructor. Constructs a style using the same PIMPL as other. More...
 
std::string name () const
 Returns the name of this style. More...
 
style name (const std::string &name)
 Sets the name of this style to name. More...
 
bool hidden () const
 Returns true if this style is hidden. More...
 
style hidden (bool value)
 Sets the hidden state of this style to value. A hidden style will not be shown in the list of selectable styles in the UI, but will still apply its formatting to cells using it. More...
 
bool custom_builtin () const
 Returns true if this is a builtin style that has been customized and should therefore be persisted in the workbook. More...
 
std::size_t builtin_id () const
 Returns the index of the builtin style that this style is an instance of or is a customized version thereof. If style::builtin() is false, this will throw an invalid_attribute exception. More...
 
bool builtin () const
 Returns true if this is a builtin style. More...
 
class alignment alignment () const
 Returns the alignment of this style. More...
 
bool alignment_applied () const
 Returns true if the alignment of this style should be applied to cells using it. More...
 
style alignment (const xlnt::alignment &new_alignment, optional< bool > applied={})
 Sets the alignment of this style to new_alignment. Applied, which defaults to true, determines whether the alignment should be enabled for cells using this style. More...
 
class border border () const
 Returns the border of this style. More...
 
bool border_applied () const
 Returns true if the border set for this style should be applied to cells using the style. More...
 
style border (const xlnt::border &new_border, optional< bool > applied={})
 Sets the border of this style to new_border. Applied, which defaults to true, determines whether the border should be enabled for cells using this style. More...
 
class fill fill () const
 Returns the fill of this style. More...
 
bool fill_applied () const
 Returns true if the fill set for this style should be applied to cells using the style. More...
 
style fill (const xlnt::fill &new_fill, optional< bool > applied={})
 Sets the fill of this style to new_fill. Applied, which defaults to true, determines whether the border should be enabled for cells using this style. More...
 
class font font () const
 Returns the font of this style. More...
 
bool font_applied () const
 Returns true if the font set for this style should be applied to cells using the style. More...
 
style font (const xlnt::font &new_font, optional< bool > applied={})
 Sets the font of this style to new_font. Applied, which defaults to true, determines whether the font should be enabled for cells using this style. More...
 
class number_format number_format () const
 Returns the number_format of this style. More...
 
bool number_format_applied () const
 Returns true if the number_format set for this style should be applied to cells using the style. More...
 
style number_format (const xlnt::number_format &new_number_format, optional< bool > applied={})
 Sets the number format of this style to new_number_format. Applied, which defaults to true, determines whether the number format should be enabled for cells using this style. More...
 
class protection protection () const
 Returns the protection of this style. More...
 
bool protection_applied () const
 Returns true if the protection set for this style should be applied to cells using the style. More...
 
style protection (const xlnt::protection &new_protection, optional< bool > applied={})
 Sets the border of this style to new_protection. Applied, which defaults to true, determines whether the protection should be enabled for cells using this style. More...
 
bool pivot_button () const
 Returns true if the pivot table interface is enabled for this style. More...
 
void pivot_button (bool show)
 If show is true, a pivot table interface will be displayed for cells using this style. More...
 
bool quote_prefix () const
 Returns true if this style 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 style (e.g. "abc" will appear as "'abc"). The text will also not be stored in sharedStrings when this is enabled. More...
 
bool operator== (const style &other) const
 Returns true if this style is equivalent to other. More...
 
bool operator!= (const style &other) const
 Returns true if this style is not equivalent to other. More...
 

Friends

struct detail::stylesheet
 
class detail::xlsx_consumer
 

Detailed Description

Describes a style which has a name and can be applied to multiple individual formats. In Excel this is a "Cell Style".

Constructor & Destructor Documentation

◆ style() [1/2]

xlnt::style::style ( )
delete

Delete zero-argument constructor

◆ style() [2/2]

xlnt::style::style ( const style other)
default

Default copy constructor. Constructs a style using the same PIMPL as other.

Member Function Documentation

◆ alignment() [1/2]

class alignment xlnt::style::alignment ( ) const

Returns the alignment of this style.

◆ alignment() [2/2]

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

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

◆ alignment_applied()

bool xlnt::style::alignment_applied ( ) const

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

◆ border() [1/2]

class border xlnt::style::border ( ) const

Returns the border of this style.

◆ border() [2/2]

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

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

◆ border_applied()

bool xlnt::style::border_applied ( ) const

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

◆ builtin()

bool xlnt::style::builtin ( ) const

Returns true if this is a builtin style.

◆ builtin_id()

std::size_t xlnt::style::builtin_id ( ) const

Returns the index of the builtin style that this style is an instance of or is a customized version thereof. If style::builtin() is false, this will throw an invalid_attribute exception.

◆ custom_builtin()

bool xlnt::style::custom_builtin ( ) const

Returns true if this is a builtin style that has been customized and should therefore be persisted in the workbook.

◆ fill() [1/2]

class fill xlnt::style::fill ( ) const

Returns the fill of this style.

◆ fill() [2/2]

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

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

◆ fill_applied()

bool xlnt::style::fill_applied ( ) const

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

◆ font() [1/2]

class font xlnt::style::font ( ) const

Returns the font of this style.

◆ font() [2/2]

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

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

◆ font_applied()

bool xlnt::style::font_applied ( ) const

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

◆ hidden() [1/2]

bool xlnt::style::hidden ( ) const

Returns true if this style is hidden.

◆ hidden() [2/2]

style xlnt::style::hidden ( bool  value)

Sets the hidden state of this style to value. A hidden style will not be shown in the list of selectable styles in the UI, but will still apply its formatting to cells using it.

◆ name() [1/2]

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

Returns the name of this style.

◆ name() [2/2]

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

Sets the name of this style to name.

◆ number_format() [1/2]

class number_format xlnt::style::number_format ( ) const

Returns the number_format of this style.

◆ number_format() [2/2]

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

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

◆ number_format_applied()

bool xlnt::style::number_format_applied ( ) const

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

◆ operator!=()

bool xlnt::style::operator!= ( const style other) const

Returns true if this style is not equivalent to other.

◆ operator==()

bool xlnt::style::operator== ( const style other) const

Returns true if this style is equivalent to other.

◆ pivot_button() [1/2]

bool xlnt::style::pivot_button ( ) const

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

◆ pivot_button() [2/2]

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

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

◆ protection() [1/2]

class protection xlnt::style::protection ( ) const

Returns the protection of this style.

◆ protection() [2/2]

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

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

◆ protection_applied()

bool xlnt::style::protection_applied ( ) const

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

◆ quote_prefix() [1/2]

bool xlnt::style::quote_prefix ( ) const

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

◆ quote_prefix() [2/2]

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

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


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