diff options
| author | Jurriaan Pruis <[email protected]> | 2014-01-15 23:44:02 +0100 |
|---|---|---|
| committer | Jurriaan Pruis <[email protected]> | 2014-02-26 20:09:21 +0100 |
| commit | be8e00332c73439cf17083173ea74f1505100df9 (patch) | |
| tree | 383ec2e23fc0a14aa5ad90e139648a79814eeded /lib/axlsx/workbook/worksheet/table.rb | |
| parent | a271a7d0f26ecb26d01aad00e094744d6fe8b0d2 (diff) | |
| download | caxlsx-be8e00332c73439cf17083173ea74f1505100df9.tar.gz caxlsx-be8e00332c73439cf17083173ea74f1505100df9.zip | |
Huge refactoring
Do not create huge strings
Let Row inherit from SimpleTypedList
Optimized sanitizing
Optimized validation
And more..
Diffstat (limited to 'lib/axlsx/workbook/worksheet/table.rb')
| -rw-r--r-- | lib/axlsx/workbook/worksheet/table.rb | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/axlsx/workbook/worksheet/table.rb b/lib/axlsx/workbook/worksheet/table.rb index 94474c57..6df71828 100644 --- a/lib/axlsx/workbook/worksheet/table.rb +++ b/lib/axlsx/workbook/worksheet/table.rb @@ -58,7 +58,7 @@ module Axlsx # @param [String, Cell] v # @return [Title] def name=(v) - DataTypeValidator.validate "#{self.class}.name", [String], v + DataTypeValidator.validate :table_name, [String], v if v.is_a?(String) @name = v end @@ -75,12 +75,12 @@ module Axlsx # @return [String] def to_xml_string(str = '') str << '<?xml version="1.0" encoding="UTF-8"?>' - str << '<table xmlns="' << XML_NS << '" id="' << (index+1).to_s << '" name="' << @name << '" displayName="' << @name.gsub(/\s/,'_') << '" ' - str << 'ref="' << @ref << '" totalsRowShown="0">' - str << '<autoFilter ref="' << @ref << '"/>' - str << '<tableColumns count="' << header_cells.length.to_s << '">' + str << ('<table xmlns="' << XML_NS << '" id="' << (index+1).to_s << '" name="' << @name << '" displayName="' << @name.gsub(/\s/,'_') << '" ') + str << ('ref="' << @ref << '" totalsRowShown="0">') + str << ('<autoFilter ref="' << @ref << '"/>') + str << ('<tableColumns count="' << header_cells.length.to_s << '">') header_cells.each_with_index do |cell,index| - str << '<tableColumn id ="' << (index+1).to_s << '" name="' << cell.value << '"/>' + str << ('<tableColumn id ="' << (index+1).to_s << '" name="' << cell.value << '"/>') end str << '</tableColumns>' table_style_info.to_xml_string(str) |
