class Axlsx::Builder::Element
Attributes
border_thickness[RW]
borders[RW]
comment[RW]
format[RW]
merge[RW]
pos[R]
text[RW]
Public Class Methods
new(attrs={})
click to toggle source
Calls superclass method
Axlsx::Builder::Object::new
# File lib/axlsx/builder.rb, line 65 def initialize(attrs={}) @pos = Position.new @format = Format.new super end
Public Instance Methods
col()
click to toggle source
# File lib/axlsx/builder.rb, line 76 def col; pos.col; end
color()
click to toggle source
# File lib/axlsx/builder.rb, line 79 def color; format.color; end
combined_style()
click to toggle source
# 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()
click to toggle source
# File lib/axlsx/builder.rb, line 78 def font; format.font; end
h_align()
click to toggle source
# File lib/axlsx/builder.rb, line 80 def h_align; format.alignment.horizontal; end
pos=(pos)
click to toggle source
# File lib/axlsx/builder.rb, line 71 def pos=(pos) @pos = Position.new(row: pos[0], col: pos[1]) end
row()
click to toggle source
# File lib/axlsx/builder.rb, line 75 def row; pos.row; end
style()
click to toggle source
# File lib/axlsx/builder.rb, line 77 def style; format.style; end
v_align()
click to toggle source
# File lib/axlsx/builder.rb, line 81 def v_align; format.alignment.vertical; end