Class: Axlsx::Dxf
- Inherits:
-
Object
- Object
- Axlsx::Dxf
- Defined in:
- lib/axlsx/stylesheet/dxf.rb
Overview
The Dxf class defines an incremental formatting record for use in Styles. The recommended way to manage styles for your workbook is with Styles#add_style
Constant Summary collapse
- CHILD_ELEMENTS =
The order in which the child elements is put in the XML seems to be important for Excel
[:font, :numFmt, :fill, :alignment, :border, :protection]
Instance Attribute Summary collapse
-
#alignment ⇒ CellAlignment
The cell alignment for this style.
-
#border ⇒ Border
the border to be used in this style.
-
#fill ⇒ Fill
the child fill to be used in this style.
-
#font ⇒ Font
the child font to be used for this style.
-
#numFmt ⇒ NumFmt
the child NumFmt to be used to this style.
-
#protection ⇒ CellProtection
The cell protection for this style.
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Dxf
constructor
Creates a new Xf object.
-
#to_xml_string(str = '') ⇒ String
Serializes the object.
Constructor Details
#initialize(options = {}) ⇒ Dxf
Creates a new Xf object
44 45 46 47 48 49 |
# File 'lib/axlsx/stylesheet/dxf.rb', line 44 def initialize(={}) .each do |o| next if o[1].nil? self.send("#{o[0]}=", o[1]) if self.respond_to? "#{o[0]}=" end end |
Instance Attribute Details
#alignment ⇒ CellAlignment
The cell alignment for this style
14 15 16 |
# File 'lib/axlsx/stylesheet/dxf.rb', line 14 def alignment @alignment end |
#border ⇒ Border
the border to be used in this style
35 36 37 |
# File 'lib/axlsx/stylesheet/dxf.rb', line 35 def border @border end |
#fill ⇒ Fill
the child fill to be used in this style
31 32 33 |
# File 'lib/axlsx/stylesheet/dxf.rb', line 31 def fill @fill end |
#font ⇒ Font
the child font to be used for this style
27 28 29 |
# File 'lib/axlsx/stylesheet/dxf.rb', line 27 def font @font end |
#numFmt ⇒ NumFmt
the child NumFmt to be used to this style
23 24 25 |
# File 'lib/axlsx/stylesheet/dxf.rb', line 23 def numFmt @numFmt end |
#protection ⇒ CellProtection
The cell protection for this style
19 20 21 |
# File 'lib/axlsx/stylesheet/dxf.rb', line 19 def protection @protection end |
Instance Method Details
#to_xml_string(str = '') ⇒ String
Serializes the object
67 68 69 70 71 72 73 74 75 |
# File 'lib/axlsx/stylesheet/dxf.rb', line 67 def to_xml_string(str = '') str << '<dxf>' # Dxf elements have no attributes. All of the instance variables # are child elements. CHILD_ELEMENTS.each do |element| self.send(element).to_xml_string(str) if self.send(element) end str << '</dxf>' end |