Module: RubyXL::CellConvenienceMethods

Included in:
Cell
Defined in:
lib/rubyXL/convenience_methods.rb

Instance Method Summary collapse

Instance Method Details

#change_border(direction, weight) ⇒ Object



597
598
599
600
# File 'lib/rubyXL/convenience_methods.rb', line 597

def change_border(direction, weight)
  validate_worksheet
  self.style_index = workbook.modify_border(self.style_index, direction, weight)
end

#change_horizontal_alignment(alignment = 'center') ⇒ Object



582
583
584
585
# File 'lib/rubyXL/convenience_methods.rb', line 582

def change_horizontal_alignment(alignment = 'center')
  validate_worksheet
  self.style_index = workbook.modify_alignment(self.style_index) { |a| a.horizontal = alignment }
end

#change_text_wrap(wrap = false) ⇒ Object



592
593
594
595
# File 'lib/rubyXL/convenience_methods.rb', line 592

def change_text_wrap(wrap = false)
  validate_worksheet
  self.style_index = workbook.modify_alignment(self.style_index) { |a| a.wrap_text = wrap }
end

#change_vertical_alignment(alignment = 'center') ⇒ Object



587
588
589
590
# File 'lib/rubyXL/convenience_methods.rb', line 587

def change_vertical_alignment(alignment = 'center')
  validate_worksheet
  self.style_index = workbook.modify_alignment(self.style_index) { |a| a.vertical = alignment }
end

#fill_colorObject



637
638
639
640
# File 'lib/rubyXL/convenience_methods.rb', line 637

def fill_color()
  validate_worksheet
  return workbook.get_fill_color(get_cell_xf)
end

#font_colorObject



632
633
634
635
# File 'lib/rubyXL/convenience_methods.rb', line 632

def font_color()
  validate_worksheet
  get_cell_font.get_rgb_color || '000000'
end

#font_nameObject



622
623
624
625
# File 'lib/rubyXL/convenience_methods.rb', line 622

def font_name()
  validate_worksheet
  get_cell_font.get_name
end

#font_sizeObject



627
628
629
630
# File 'lib/rubyXL/convenience_methods.rb', line 627

def font_size()
  validate_worksheet
  get_cell_font.get_size
end

#get_border(direction) ⇒ Object



577
578
579
580
# File 'lib/rubyXL/convenience_methods.rb', line 577

def get_border(direction)
  validate_worksheet
  get_cell_border.get_edge_style(direction)
end

#horizontal_alignmentObject



642
643
644
645
646
647
# File 'lib/rubyXL/convenience_methods.rb', line 642

def horizontal_alignment()
  validate_worksheet
  xf_obj = get_cell_xf
  return nil if xf_obj.alignment.nil?
  xf_obj.alignment.horizontal
end

#is_boldedObject



607
608
609
610
# File 'lib/rubyXL/convenience_methods.rb', line 607

def is_bolded()
  validate_worksheet
  get_cell_font.is_bold
end

#is_italicizedObject



602
603
604
605
# File 'lib/rubyXL/convenience_methods.rb', line 602

def is_italicized()
  validate_worksheet
  get_cell_font.is_italic
end

#is_struckthroughObject



617
618
619
620
# File 'lib/rubyXL/convenience_methods.rb', line 617

def is_struckthrough()
  validate_worksheet
  get_cell_font.is_strikethrough
end

#is_underlinedObject



612
613
614
615
# File 'lib/rubyXL/convenience_methods.rb', line 612

def is_underlined()
  validate_worksheet
  get_cell_font.is_underlined
end

#text_wrapObject



656
657
658
659
660
661
# File 'lib/rubyXL/convenience_methods.rb', line 656

def text_wrap()
  validate_worksheet
  xf_obj = get_cell_xf
  return nil if xf_obj.alignment.nil?
  xf_obj.alignment.wrap_text
end

#vertical_alignmentObject



649
650
651
652
653
654
# File 'lib/rubyXL/convenience_methods.rb', line 649

def vertical_alignment()
  validate_worksheet
  xf_obj = get_cell_xf
  return nil if xf_obj.alignment.nil?
  xf_obj.alignment.vertical
end