Method: Axlsx::Table#to_xml_string
- Defined in:
- lib/axlsx/workbook/worksheet/table.rb
#to_xml_string(str = '') ⇒ String
Serializes the object
69 70 71 72 73 74 75 76 77 78 79 80 81 82 |
# File 'lib/axlsx/workbook/worksheet/table.rb', line 69 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 << '">' header_cells.each_with_index do |cell,index| str << '<tableColumn id ="' << (index+1).to_s << '" name="' << cell.value << '"/>' end str << '</tableColumns>' #TODO implement tableStyleInfo str << '<tableStyleInfo showFirstColumn="0" showLastColumn="0" showRowStripes="1" showColumnStripes="0" name="TableStyleMedium9" />' str << '</table>' end |