Class: Axlsx::Workbook

Inherits:
Object
  • Object
show all
Defined in:
lib/barkest_core/extensions/axlsx_extenstions.rb

Overview

The Workbook class is used to manage the Excel file in memory.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#packageObject

Returns the value of attribute package.



42
43
44
# File 'lib/barkest_core/extensions/axlsx_extenstions.rb', line 42

def package
  @package
end

Instance Method Details

#predefined_stylesObject

Gets the predefined style list.

The predefined_styles hash contains :bold, :date, :float, :integer, :percent, :currency, :text, :wrapped, and :normal styles for you to use.



50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# File 'lib/barkest_core/extensions/axlsx_extenstions.rb', line 50

def predefined_styles
  @predefined_styles ||=
      begin
        tmp = {}
        styles do |s|
          tmp = {
              bold:       s.add_style(b: true, alignment: { vertical: :top }),
              date:       s.add_style(format_code: 'mm/dd/yyyy', alignment: { vertical: :top }),
              float:      s.add_style(format_code: '#,##0.00', alignment: { vertical: :top }),
              integer:    s.add_style(format_code: '#,##0', alignment: { vertical: :top }),
              percent:    s.add_style(num_fmt: 9, alignment: { vertical: :top }),
              currency:   s.add_style(num_fmt: 7, alignment: { vertical: :top }),
              text:       s.add_style(format_code: '@', alignment: { vertical: :top }),
              wrapped:    s.add_style(alignment: { wrap_text: true, vertical: :top }),
              normal:     s.add_style(alignment: { vertical: :top })
          }
        end
        tmp
      end
end