Class: OpenXml::Xlsx::Elements::Font

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#nameObject

Returns the value of attribute name

Returns:

  • (Object)

    the current value of name



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

def name
  @name
end

#sizeObject

Returns the value of attribute size

Returns:

  • (Object)

    the current value of size



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

def size
  @size
end

#stylesObject

Returns the value of attribute styles

Returns:

  • (Object)

    the current value of styles



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

def styles
  @styles
end

Instance Method Details

#to_xml(xml) ⇒ Object



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

def to_xml(xml)
  xml.font do
    xml.sz val: size
    xml.name val: name
    if styles
      xml.b if styles[:bold]
      xml.i if styles[:italic]
      xml.u if styles[:underline]
      styles[:color].to_xml("color", xml) if styles[:color]
    end
  end
end