class OoxmlParser::PivotTableDefinition
Class for parsing <PivotTableDefinition> tag
Attributes
@return [True, False] should alignment formats be applied
@return [True, False] should border formats be applied
@return [True, False] should font formats be applied
@return [True, False] should number formats be applied
@return [True, False] should pattern formats be applied
@return [True, False] should width height formats be applied
@return [Integer] id of cache
@return [RowFields] column fields
@return [ColumnRowItems] column items
@return [Integer] creation version
@return [String] data caption
@return [DataFields] data fields
@return [Integer] indent
@return [True, False] should item print titles
@return [Location] location data
@return [True, False] is there multiple fields filters
@return [String] name of table
@return [True, False] outline
@return [True, False] outline data
@return [PageFields] page fields
@return [PivotFields] pivot fields
@return [RowFields] row fields
@return [ColumnRowItems] row items
@return [PivotTableStyleInfo] style info
@return [True, False] should auto formatting be used
Public Instance Methods
Parse PivotTableDefinition
object @param [String] file path @return [PivotTableDefinition] result of parsing
# File lib/ooxml_parser/xlsx_parser/workbook/pivot_table_definition.rb, line 68 def parse(file) doc = parse_xml("#{root_object.unpacked_folder}/#{file}") node = doc.xpath('//xmlns:pivotTableDefinition').first node.attributes.each do |key, value| case key when 'name' @name = value.value.to_s when 'cacheId' @cache_id = value.value.to_i when 'applyNumberFormats' @apply_number_formats = attribute_enabled?(value) when 'applyBorderFormats' @apply_border_formats = attribute_enabled?(value) when 'applyFontFormats' @apply_font_formats = attribute_enabled?(value) when 'applyPatternFormats' @apply_pattern_formats = attribute_enabled?(value) when 'applyAlignmentFormats' @apply_alignment_formats = attribute_enabled?(value) when 'applyWidthHeightFormats' @apply_width_height_formats = attribute_enabled?(value) when 'useAutoFormatting' @use_auto_formatting = attribute_enabled?(value) when 'itemPrintTitles' @item_print_titles = attribute_enabled?(value) when 'dataCaption' @data_caption = value.value.to_s when 'createdVersion' @created_version = value.value.to_i when 'indent' @indent = value.value.to_i when 'outline' @outline = attribute_enabled?(value) when 'outlineData' @outline_data = attribute_enabled?(value) when 'multipleFieldFilters' @multiple_field_filters = attribute_enabled?(value) end end node.xpath('*').each do |node_child| case node_child.name when 'location' @location = Location.new(parent: self).parse(node_child) when 'pivotFields' @pivot_fields = PivotFields.new(parent: self).parse(node_child) when 'rowItems' @row_items = ColumnRowItems.new(parent: self).parse(node_child) when 'colItems' @column_items = ColumnRowItems.new(parent: self).parse(node_child) when 'pivotTableStyleInfo' @style_info = PivotTableStyleInfo.new(parent: self).parse(node_child) when 'dataFields' @data_fields = DataFields.new(parent: self).parse(node_child) when 'pageFields' @page_fields = PageFields.new(parent: self).parse(node_child) when 'rowFields' @row_fields = RowFields.new(parent: self).parse(node_child) when 'colFields' @column_fields = RowFields.new(parent: self).parse(node_child) end end self end