Class: Axlsx::CellStyle

Inherits:
Object
  • Object
show all
Includes:
OptionsParser, SerializedAttributes
Defined in:
lib/axlsx/stylesheet/cell_style.rb

Overview

Note:

Using Styles#add_style is the recommended way to manage cell styling.

CellStyle defines named styles that reference defined formatting records and can be used in your worksheet.

See Also:

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from SerializedAttributes

#declared_attributes, included, #serialized_attributes, #serialized_element_attributes, #serialized_tag

Methods included from OptionsParser

#parse_options

Constructor Details

#initialize(options = {}) ⇒ CellStyle

Creats a new CellStyle object

Parameters:

  • options (Hash) (defaults to: {})

    a customizable set of options

Options Hash (options):

  • name (String)
  • xfId (Integer)
  • buildinId (Integer)
  • iLevel (Integer)
  • hidden (Boolean)
  • customBuiltIn (Boolean)


16
17
18
# File 'lib/axlsx/stylesheet/cell_style.rb', line 16

def initialize(options = {})
  parse_options options
end

Instance Attribute Details

#builtinIdInteger

The buildinId to use when this named style is applied

Returns:

  • (Integer)

See Also:



34
35
36
# File 'lib/axlsx/stylesheet/cell_style.rb', line 34

def builtinId
  @builtinId
end

#customBuiltinBoolean

Indicates that the build in style reference has been customized.

Returns:

  • (Boolean)


46
47
48
# File 'lib/axlsx/stylesheet/cell_style.rb', line 46

def customBuiltin
  @customBuiltin
end

#hiddenBoolean

Determines if this named style should show in the list of styles when using excel

Returns:

  • (Boolean)


42
43
44
# File 'lib/axlsx/stylesheet/cell_style.rb', line 42

def hidden
  @hidden
end

#iLevelInteger

Determines if this formatting is for an outline style, and what level of the outline it is to be applied to.

Returns:

  • (Integer)


38
39
40
# File 'lib/axlsx/stylesheet/cell_style.rb', line 38

def iLevel
  @iLevel
end

#nameString

The name of this cell style

Returns:

  • (String)


24
25
26
# File 'lib/axlsx/stylesheet/cell_style.rb', line 24

def name
  @name
end

#xfIdInteger

The formatting record id this named style utilizes

Returns:

  • (Integer)

See Also:



29
30
31
# File 'lib/axlsx/stylesheet/cell_style.rb', line 29

def xfId
  @xfId
end

Instance Method Details

#to_xml_string(str = '') ⇒ String

Serializes the object

Parameters:

  • str (String) (defaults to: '')

Returns:

  • (String)


64
65
66
# File 'lib/axlsx/stylesheet/cell_style.rb', line 64

def to_xml_string(str = '')
  serialized_tag('cellStyle', str)
end