Class: OpenXml::Xlsx::Elements::PatternFill

Inherits:
Struct
  • Object
show all
Defined in:
lib/openxml/xlsx/elements/pattern_fill.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#background_colorObject

Returns the value of attribute background_color

Returns:

  • (Object)

    the current value of background_color



4
5
6
# File 'lib/openxml/xlsx/elements/pattern_fill.rb', line 4

def background_color
  @background_color
end

#foreground_colorObject

Returns the value of attribute foreground_color

Returns:

  • (Object)

    the current value of foreground_color



4
5
6
# File 'lib/openxml/xlsx/elements/pattern_fill.rb', line 4

def foreground_color
  @foreground_color
end

#typeObject

Returns the value of attribute type

Returns:

  • (Object)

    the current value of type



4
5
6
# File 'lib/openxml/xlsx/elements/pattern_fill.rb', line 4

def type
  @type
end

Instance Method Details

#to_xml(xml) ⇒ Object



6
7
8
9
10
11
12
13
14
15
# File 'lib/openxml/xlsx/elements/pattern_fill.rb', line 6

def to_xml(xml)
  xml.fill do
    xml.patternFill(patternType: type) do
      if type.to_s == "solid"
        foreground_color.to_xml("fgColor", xml)
        background_color.to_xml("bgColor", xml)
      end
    end
  end
end