Class: Axlsx::Fill

Inherits:
Object
  • Object
show all
Defined in:
lib/axlsx/stylesheet/fill.rb

Overview

Note:

The recommended way to manage styles in your workbook is to use Styles#add_style.

The Fill is a formatting object that manages the background color, and pattern for cells.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(fill_type) ⇒ Fill

Creates a new Fill object

Parameters:

Raises:

  • (ArgumentError)

    if the fill_type parameter is not a PatternFill or a GradientFill instance



17
18
19
# File 'lib/axlsx/stylesheet/fill.rb', line 17

def initialize(fill_type)
  self.fill_type = fill_type
end

Instance Attribute Details

#fill_typePatternFill, GradientFill

The type of fill



12
13
14
# File 'lib/axlsx/stylesheet/fill.rb', line 12

def fill_type
  @fill_type
end

Instance Method Details

#to_xml_string(str = '') ⇒ String

Serializes the object

Parameters:

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

Returns:

  • (String)


24
25
26
27
28
# File 'lib/axlsx/stylesheet/fill.rb', line 24

def to_xml_string(str = '')
  str << '<fill>'
  @fill_type.to_xml_string(str)
  str << '</fill>'
end