Method: Axlsx::PivotTableCacheDefinition#to_xml_string
- Defined in:
- lib/axlsx/workbook/worksheet/pivot_table_cache_definition.rb
#to_xml_string(str = '') ⇒ String
Serializes the object
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/axlsx/workbook/worksheet/pivot_table_cache_definition.rb', line 48 def to_xml_string(str = '') str << '<?xml version="1.0" encoding="UTF-8"?>' str << ('<pivotCacheDefinition xmlns="' << XML_NS << '" xmlns:r="' << XML_NS_R << '" invalid="1" refreshOnLoad="1" recordCount="0">') str << '<cacheSource type="worksheet">' str << ( '<worksheetSource ref="' << pivot_table.range << '" sheet="' << pivot_table.data_sheet.name << '"/>') str << '</cacheSource>' str << ( '<cacheFields count="' << pivot_table.header_cells_count.to_s << '">') pivot_table.header_cells.each do |cell| str << ( '<cacheField name="' << cell.value << '" numFmtId="0">') str << '<sharedItems count="0">' str << '</sharedItems>' str << '</cacheField>' end str << '</cacheFields>' str << '</pivotCacheDefinition>' end |