# encoding: UTF-8 module Axlsx # Table # @note Worksheet#add_pivot_table is the recommended way to create tables for your worksheets. # @see README for examples class PivotTableCacheDefinition include Axlsx::OptionsParser # Creates a new PivotTable object # @param [String] pivot_table The pivot table this cache definition is in def initialize(pivot_table) @pivot_table = pivot_table end # # The reference to the pivot table data # # @return [PivotTable] attr_reader :pivot_table # The index of this chart in the workbooks charts collection # @return [Integer] def index pivot_table.sheet.workbook.pivot_tables.index(pivot_table) end # The part name for this table # @return [String] def pn "#{PIVOT_TABLE_CACHE_DEFINITION_PN % (index+1)}" end # The identifier for this cache # @return [Integer] def cache_id index + 1 end # The relationship id for this pivot table cache definition. # @see Relationship#Id # @return [String] def rId pivot_table.relationships.for(self).Id end # Serializes the object # @param [String] str # @return [String] def to_xml_string(str = '') str << '' str << ('') str << '' str << ( '') str << '' str << ( '') pivot_table.header_cells.each do |cell| str << ( '') str << '' str << '' str << '' end str << '' str << '' end end end