Class: OoxmlParser::XlsxShapeGrouping

Inherits:
Object
  • Object
show all
Defined in:
lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/xlsx_drawing/xlsx_shape_grouping.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(shapes = [], pictures = []) ⇒ XlsxShapeGrouping

Returns a new instance of XlsxShapeGrouping.



5
6
7
8
# File 'lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/xlsx_drawing/xlsx_shape_grouping.rb', line 5

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

Instance Attribute Details

#groupingObject

Returns the value of attribute grouping.



3
4
5
# File 'lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/xlsx_drawing/xlsx_shape_grouping.rb', line 3

def grouping
  @grouping
end

#picturesObject

Returns the value of attribute pictures.



3
4
5
# File 'lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/xlsx_drawing/xlsx_shape_grouping.rb', line 3

def pictures
  @pictures
end

#propertiesObject

Returns the value of attribute properties.



3
4
5
# File 'lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/xlsx_drawing/xlsx_shape_grouping.rb', line 3

def properties
  @properties
end

#shapesObject

Returns the value of attribute shapes.



3
4
5
# File 'lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/xlsx_drawing/xlsx_shape_grouping.rb', line 3

def shapes
  @shapes
end

Class Method Details

.parse(grouping_node) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/xlsx_drawing/xlsx_shape_grouping.rb', line 10

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