Module: RubyXL::CellConvenienceMethods
- Included in:
- Cell
- Defined in:
- lib/rubyXL/convenience_methods.rb
Instance Method Summary collapse
- #change_border(direction, weight) ⇒ Object
- #change_contents(data, formula_expression = nil) ⇒ Object
- #change_horizontal_alignment(alignment = 'center') ⇒ Object
- #change_text_wrap(wrap = false) ⇒ Object
- #change_vertical_alignment(alignment = 'center') ⇒ Object
- #fill_color ⇒ Object
- #font_color ⇒ Object
- #font_name ⇒ Object
- #font_size ⇒ Object
- #get_border(direction) ⇒ Object
- #horizontal_alignment ⇒ Object
- #is_bolded ⇒ Object
- #is_italicized ⇒ Object
- #is_struckthrough ⇒ Object
- #is_underlined ⇒ Object
- #text_wrap ⇒ Object
- #vertical_alignment ⇒ Object
Instance Method Details
#change_border(direction, weight) ⇒ Object
615 616 617 618 |
# File 'lib/rubyXL/convenience_methods.rb', line 615 def change_border(direction, weight) validate_worksheet self.style_index = workbook.modify_border(self.style_index, direction, weight) end |
#change_contents(data, formula_expression = nil) ⇒ Object
577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 |
# File 'lib/rubyXL/convenience_methods.rb', line 577 def change_contents(data, formula_expression = nil) validate_worksheet if formula_expression then self.datatype = nil self.formula = RubyXL::Formula.new(:expression => formula_expression) else self.datatype = case data when Date, Numeric then nil else RubyXL::DataType::RAW_STRING end end data = workbook.date_to_num(data) if data.is_a?(Date) self.raw_value = data end |
#change_horizontal_alignment(alignment = 'center') ⇒ Object
600 601 602 603 |
# File 'lib/rubyXL/convenience_methods.rb', line 600 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
610 611 612 613 |
# File 'lib/rubyXL/convenience_methods.rb', line 610 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
605 606 607 608 |
# File 'lib/rubyXL/convenience_methods.rb', line 605 def change_vertical_alignment(alignment = 'center') validate_worksheet self.style_index = workbook.modify_alignment(self.style_index) { |a| a.vertical = alignment } end |
#fill_color ⇒ Object
655 656 657 658 |
# File 'lib/rubyXL/convenience_methods.rb', line 655 def fill_color() validate_worksheet return workbook.get_fill_color(get_cell_xf) end |
#font_color ⇒ Object
650 651 652 653 |
# File 'lib/rubyXL/convenience_methods.rb', line 650 def font_color() validate_worksheet get_cell_font.get_rgb_color || '000000' end |
#font_name ⇒ Object
640 641 642 643 |
# File 'lib/rubyXL/convenience_methods.rb', line 640 def font_name() validate_worksheet get_cell_font.get_name end |
#font_size ⇒ Object
645 646 647 648 |
# File 'lib/rubyXL/convenience_methods.rb', line 645 def font_size() validate_worksheet get_cell_font.get_size end |
#get_border(direction) ⇒ Object
595 596 597 598 |
# File 'lib/rubyXL/convenience_methods.rb', line 595 def get_border(direction) validate_worksheet get_cell_border.get_edge_style(direction) end |
#horizontal_alignment ⇒ Object
660 661 662 663 664 665 |
# File 'lib/rubyXL/convenience_methods.rb', line 660 def horizontal_alignment() validate_worksheet xf_obj = get_cell_xf return nil if xf_obj.alignment.nil? xf_obj.alignment.horizontal end |
#is_bolded ⇒ Object
625 626 627 628 |
# File 'lib/rubyXL/convenience_methods.rb', line 625 def is_bolded() validate_worksheet get_cell_font.is_bold end |
#is_italicized ⇒ Object
620 621 622 623 |
# File 'lib/rubyXL/convenience_methods.rb', line 620 def is_italicized() validate_worksheet get_cell_font.is_italic end |
#is_struckthrough ⇒ Object
635 636 637 638 |
# File 'lib/rubyXL/convenience_methods.rb', line 635 def is_struckthrough() validate_worksheet get_cell_font.is_strikethrough end |
#is_underlined ⇒ Object
630 631 632 633 |
# File 'lib/rubyXL/convenience_methods.rb', line 630 def is_underlined() validate_worksheet get_cell_font.is_underlined end |
#text_wrap ⇒ Object
674 675 676 677 678 679 |
# File 'lib/rubyXL/convenience_methods.rb', line 674 def text_wrap() validate_worksheet xf_obj = get_cell_xf return nil if xf_obj.alignment.nil? xf_obj.alignment.wrap_text end |
#vertical_alignment ⇒ Object
667 668 669 670 671 672 |
# File 'lib/rubyXL/convenience_methods.rb', line 667 def vertical_alignment() validate_worksheet xf_obj = get_cell_xf return nil if xf_obj.alignment.nil? xf_obj.alignment.vertical end |