diff options
| author | Randy Morgan <[email protected]> | 2012-03-21 23:00:28 +0900 |
|---|---|---|
| committer | Randy Morgan <[email protected]> | 2012-03-21 23:00:28 +0900 |
| commit | bdf77ceb217753b7e09dd54ef1e0a3842859d1b1 (patch) | |
| tree | a410da1d9320879fb04c85910c734c4678efbcad | |
| parent | 778142d9175da18026068599146cb7507fb4bc5f (diff) | |
| download | caxlsx-bdf77ceb217753b7e09dd54ef1e0a3842859d1b1.tar.gz caxlsx-bdf77ceb217753b7e09dd54ef1e0a3842859d1b1.zip | |
tiny bit of restructuring
| -rw-r--r-- | lib/axlsx.rb | 1 | ||||
| -rw-r--r-- | lib/axlsx/workbook/workbook.rb | 3 | ||||
| -rw-r--r-- | lib/axlsx/workbook/worksheet/table.rb (renamed from lib/axlsx/table/table.rb) | 22 |
3 files changed, 13 insertions, 13 deletions
diff --git a/lib/axlsx.rb b/lib/axlsx.rb index 399e740e..eb5068b5 100644 --- a/lib/axlsx.rb +++ b/lib/axlsx.rb @@ -22,7 +22,6 @@ require 'axlsx/rels/relationships.rb' require 'axlsx/drawing/drawing.rb' require 'axlsx/workbook/workbook.rb' require 'axlsx/package.rb' -require 'axlsx/table/table.rb' #required gems require 'nokogiri' require 'zip/zip' diff --git a/lib/axlsx/workbook/workbook.rb b/lib/axlsx/workbook/workbook.rb index b6e0a9db..a8e0a1af 100644 --- a/lib/axlsx/workbook/workbook.rb +++ b/lib/axlsx/workbook/workbook.rb @@ -7,6 +7,7 @@ require 'axlsx/workbook/worksheet/page_margins.rb' require 'axlsx/workbook/worksheet/row.rb' require 'axlsx/workbook/worksheet/worksheet.rb' require 'axlsx/workbook/shared_strings_table.rb' +require 'axlsx/workbook/worksheet/table.rb' # The Workbook class is an xlsx workbook that manages worksheets, charts, drawings and styles. # The following parts of the Office Open XML spreadsheet specification are not implimented in this version. @@ -117,7 +118,7 @@ require 'axlsx/workbook/shared_strings_table.rb' @images = SimpleTypedList.new Pic @tables = SimpleTypedList.new Table @use_autowidth = true - + self.date1904= !options[:date1904].nil? && options[:date1904] yield self if block_given? end diff --git a/lib/axlsx/table/table.rb b/lib/axlsx/workbook/worksheet/table.rb index be78d4a0..831040f3 100644 --- a/lib/axlsx/table/table.rb +++ b/lib/axlsx/workbook/worksheet/table.rb @@ -1,7 +1,7 @@ # encoding: UTF-8 module Axlsx # Table - # @note Worksheet#add_table is the recommended way to create charts for your worksheets. + # @note Worksheet#add_table is the recommended way to create tables for your worksheets. # @see README for examples class Table @@ -14,10 +14,10 @@ module Axlsx # @return [String] attr_reader :name - # The style for the table. + # The style for the table. # @return [TableStyle] attr_reader :style - + # Creates a new Table object # @param [String] ref The reference to the table data. # @param [Sheet] ref The sheet containing the table data. @@ -46,7 +46,7 @@ module Axlsx def pn "#{TABLE_PN % (index+1)}" end - + # The relation reference id for this table # @return [String] def rId @@ -56,24 +56,24 @@ module Axlsx # The name of the Table. # @param [String, Cell] v # @return [Title] - def name=(v) + def name=(v) DataTypeValidator.validate "#{self.class}.name", [String], v if v.is_a?(String) @name = v end end - + # The style for the table. - # TODO - # def style=(v) DataTypeValidator.validate "Chart.style", Integer, v, lambda { |arg| arg >= 1 && arg <= 48 }; @style = v; end + # TODO + # def style=(v) DataTypeValidator.validate "Table.style", Integer, v, lambda { |arg| arg >= 1 && arg <= 48 }; @style = v; end # Table Serialization # serializes the table def to_xml builder = Nokogiri::XML::Builder.new(:encoding => ENCODING) do |xml| xml.table(:xmlns => XML_NS, :id => index+1, :name => @name, :displayName => @name.gsub(/\s/,'_'), :ref => @ref, :totalsRowShown => 0) { - xml.autoFilter :ref=>@ref + xml.autoFilter :ref=>@ref xml.tableColumns(:count => header_cells.length) { header_cells.each_with_index do |cell,index| xml.tableColumn :id => index+1, :name => cell.value @@ -87,9 +87,9 @@ module Axlsx end private - + # get the header cells (hackish) - def header_cells + def header_cells header = @ref.gsub(/^(\w+)(\d+)\:(\w+)\d+$/, '\1\2:\3\2') @sheet[header] end |
