diff options
| author | Randy Morgan <[email protected]> | 2012-07-20 20:47:41 +0900 |
|---|---|---|
| committer | Randy Morgan <[email protected]> | 2012-07-20 20:47:41 +0900 |
| commit | 79ae531c006ad04274aa2f42174be421b35cbfd9 (patch) | |
| tree | f3e0c760753eb17bad754587a84daf362e23f1c3 /lib | |
| parent | a8b1ada7409e18ca403ef632972f8921365f331c (diff) | |
| download | caxlsx-79ae531c006ad04274aa2f42174be421b35cbfd9.tar.gz caxlsx-79ae531c006ad04274aa2f42174be421b35cbfd9.zip | |
bring spec coverage back up to 100%
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/axlsx/drawing/d_lbls.rb | 2 | ||||
| -rw-r--r-- | lib/axlsx/workbook/worksheet/worksheet.rb | 20 |
2 files changed, 16 insertions, 6 deletions
diff --git a/lib/axlsx/drawing/d_lbls.rb b/lib/axlsx/drawing/d_lbls.rb index faf7017d..9777aeb5 100644 --- a/lib/axlsx/drawing/d_lbls.rb +++ b/lib/axlsx/drawing/d_lbls.rb @@ -23,7 +23,7 @@ module Axlsx # creates a new DLbls object def initialize(options={}) - @d_lbl_pos = :best_fit + @d_lbl_pos = :bestFit initialize_defaults options.each do |o| self.send("#{o[0]}=", o[1]) if self.respond_to? "#{o[0]}=" diff --git a/lib/axlsx/workbook/worksheet/worksheet.rb b/lib/axlsx/workbook/worksheet/worksheet.rb index f0d733c7..e81c31c7 100644 --- a/lib/axlsx/workbook/worksheet/worksheet.rb +++ b/lib/axlsx/workbook/worksheet/worksheet.rb @@ -514,6 +514,20 @@ module Axlsx r.cells[col_index] if r end + # shortcut method to access styles direclty from the worksheet + # This lets us do stuff like: + # @example + # p = Axlsx::Package.new + # p.workbook.add_worksheet(:name => 'foo') do |sheet| + # my_style = sheet.styles.add_style { :bg_color => "FF0000" } + # sheet.add_row ['Oh No!'], :styles => my_style + # end + # p.serialize 'foo.xlsx' + def styles + @styles ||= self.workbook.styles + end + + private def validate_sheet_name(name) @@ -596,11 +610,7 @@ module Axlsx def workbook=(v) DataTypeValidator.validate "Worksheet.workbook", Workbook, v; @workbook = v; end - def styles - @styles ||= self.workbook.styles - end - - def update_column_info(cells, widths=[]) + def update_column_info(cells, widths=[]) cells.each_with_index do |cell, index| col = find_or_create_column_info(index) next if widths[index] == :ignore |
