Class: Axlsx::Builder::Element
Direct Known Subclasses
Instance Attribute Summary collapse
-
#border_thickness ⇒ Object
Returns the value of attribute border_thickness.
-
#borders ⇒ Object
Returns the value of attribute borders.
-
#comment ⇒ Object
Returns the value of attribute comment.
-
#format ⇒ Object
Returns the value of attribute format.
-
#merge ⇒ Object
Returns the value of attribute merge.
-
#pos ⇒ Object
Returns the value of attribute pos.
-
#text ⇒ Object
Returns the value of attribute text.
Instance Method Summary collapse
- #col ⇒ Object
- #color ⇒ Object
- #combined_style ⇒ Object
- #font ⇒ Object
- #h_align ⇒ Object
-
#initialize(attrs = {}) ⇒ Element
constructor
A new instance of Element.
- #row ⇒ Object
- #style ⇒ Object
- #v_align ⇒ Object
Constructor Details
Instance Attribute Details
#border_thickness ⇒ Object
Returns the value of attribute border_thickness.
62 63 64 |
# File 'lib/axlsx/builder.rb', line 62 def border_thickness @border_thickness end |
#borders ⇒ Object
Returns the value of attribute borders.
62 63 64 |
# File 'lib/axlsx/builder.rb', line 62 def borders @borders end |
#comment ⇒ Object
Returns the value of attribute comment.
62 63 64 |
# File 'lib/axlsx/builder.rb', line 62 def comment @comment end |
#format ⇒ Object
Returns the value of attribute format.
62 63 64 |
# File 'lib/axlsx/builder.rb', line 62 def format @format end |
#merge ⇒ Object
Returns the value of attribute merge.
62 63 64 |
# File 'lib/axlsx/builder.rb', line 62 def merge @merge end |
#pos ⇒ Object
Returns the value of attribute pos.
61 62 63 |
# File 'lib/axlsx/builder.rb', line 61 def pos @pos end |
#text ⇒ Object
Returns the value of attribute text.
62 63 64 |
# File 'lib/axlsx/builder.rb', line 62 def text @text end |
Instance Method Details
#col ⇒ Object
76 |
# File 'lib/axlsx/builder.rb', line 76 def col; pos.col; end |
#color ⇒ Object
79 |
# File 'lib/axlsx/builder.rb', line 79 def color; format.color; end |
#combined_style ⇒ Object
83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 |
# File 'lib/axlsx/builder.rb', line 83 def combined_style combined_style = {} if self.style combined_style.merge!(b: true) if self.style.include? :bold combined_style.merge!(i: true) if self.style.include? :italic combined_style.merge!(u: true) if self.style.include? :underline combined_style.merge!(alignment: {horizontal: :center}) if self.style.include? :center combined_style.merge!(sz: 12) if self.style.include? :lg_font end combined_style.merge!(sz: self.font.size) combined_style.merge!(font_name: self.font.name) combined_style.merge!(bg_color: self.color) if self.color combined_style.merge!(fg_color: self.font.color) combined_style.merge!(alignment: {horizontal: h_align, vertical: v_align}) if self.borders == true combined_style.merge! border: {style: self.border_thickness || :medium, color: '00000000'} elsif self.borders combined_style.merge! border: {style: self.border_thickness || :medium, color: '00000000', edges: self.borders} end combined_style end |
#font ⇒ Object
78 |
# File 'lib/axlsx/builder.rb', line 78 def font; format.font; end |
#h_align ⇒ Object
80 |
# File 'lib/axlsx/builder.rb', line 80 def h_align; format.alignment.horizontal; end |
#row ⇒ Object
75 |
# File 'lib/axlsx/builder.rb', line 75 def row; pos.row; end |
#style ⇒ Object
77 |
# File 'lib/axlsx/builder.rb', line 77 def style; format.style; end |
#v_align ⇒ Object
81 |
# File 'lib/axlsx/builder.rb', line 81 def v_align; format.alignment.vertical; end |