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



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

def initialize(fill_type)
  self.fill_type = fill_type
end

Instance Attribute Details

#fill_typePatternFill, GradientFill

The type of fill



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

def fill_type
  @fill_type
end

Instance Method Details

#to_xml(xml) ⇒ String

Serializes the fill

Parameters:

  • xml (Nokogiri::XML::Builder)

    The document builder instance this objects xml will be added to.

Returns:

  • (String)


23
24
25
# File 'lib/axlsx/stylesheet/fill.rb', line 23

def to_xml(xml)
  xml.fill { @fill_type.to_xml(xml) }
end