Sha256: 9c120473b016ef5d5c92bfde4ee62757b1e97bb0e54fcd1ce20037a18c26f483

Contents?: true

Size: 1.24 KB

Versions: 2

Compression:

Stored size: 1.24 KB

Contents

module OoxmlParser
  class XlsxShapeGrouping
    attr_accessor :properties, :shapes, :pictures, :grouping

    def initialize(shapes = [], pictures = [])
      @shapes = shapes
      @pictures = pictures
    end

    def self.parse(grouping_node)
      grouping = XlsxShapeGrouping.new
      grouping_node.xpath('*').each do |grouping_node_child|
        case grouping_node_child.name
        when 'grpSpPr'
          grouping.properties = DocxShapeProperties.parse(grouping_node_child)
        when 'grpSp'
          grouping.grouping = parse(grouping_node_child)
        when 'sp'
          grouping.shapes << DocxShape.parse(grouping_node_child)
        when 'pic'
          grouping.pictures << DocxPicture.parse(grouping_node_child)
        when 'graphicFrame'
          picture = DocxPicture.new
          graphic_data_node = grouping_node_child.xpath('a:graphic/a:graphicData', 'xmlns:a' => 'http://schemas.openxmlformats.org/drawingml/2006/main')
          graphic_data_node.xpath('*').each do |graphic_data_node_child|
            case graphic_data_node_child.name
            when 'chart'
              picture.chart = Chart.parse
            end
          end
          grouping.pictures << picture
        end
      end
      grouping
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ooxml_parser-0.1.2 lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/xlsx_drawing/xlsx_shape_grouping.rb
ooxml_parser-0.1.1 lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/xlsx_drawing/xlsx_shape_grouping.rb