@@ -66,7 +66,7 @@ def tmpdir
6666 # Drawing xml contains relationships ID's and coordinates (row, col).
6767 # Drawing relationships xml contains images' locations.
6868 def load_drawings_and_rels
69- @drawings = parse_xml ( @drawing_filepath ) . css ( 'xdr|twoCellAnchor' )
69+ @drawings = parse_xml ( @drawing_filepath ) . css ( 'xdr|twoCellAnchor' , 'xdr|oneCellAnchor' )
7070 drawing_rels_filepath = expand_to_rels_path ( @drawing_filepath )
7171 @drawings_rels = parse_xml ( drawing_rels_filepath ) . css ( 'Relationships' )
7272 end
@@ -82,7 +82,7 @@ def load_images_pathnames_by_cells
8282 col_from_selector = 'xdr:from/xdr:col' . freeze
8383 col_to_selector = 'xdr:to/xdr:col' . freeze
8484
85- @drawings . xpath ( '//xdr:twoCellAnchor' ) . each do |drawing |
85+ @drawings . xpath ( '//xdr:twoCellAnchor' , '//xdr:oneCellAnchor' ) . each do |drawing |
8686 # embed = drawing.xpath(image_selector).first.attributes['embed']
8787 temp = drawing . xpath ( image_selector ) . first
8888 embed = temp . attributes [ 'embed' ] if temp
@@ -93,12 +93,17 @@ def load_images_pathnames_by_cells
9393
9494 row_from = drawing . xpath ( row_from_selector ) . text . to_i
9595 col_from = drawing . xpath ( col_from_selector ) . text . to_i
96- row_to = drawing . xpath ( row_to_selector ) . text . to_i
97- col_to = drawing . xpath ( col_to_selector ) . text . to_i
9896
99- ( col_from ..col_to ) . each do |col |
100- ( row_from ..row_to ) . each do |row |
101- @images_pathnames [ [ row , col ] ] . push ( path )
97+ if drawing . name == 'oneCellAnchor'
98+ @images_pathnames [ [ row_from , col_from ] ] . push ( path )
99+ else
100+ row_to = drawing . xpath ( row_to_selector ) . text . to_i
101+ col_to = drawing . xpath ( col_to_selector ) . text . to_i
102+
103+ ( col_from ..col_to ) . each do |col |
104+ ( row_from ..row_to ) . each do |row |
105+ @images_pathnames [ [ row , col ] ] . push ( path )
106+ end
102107 end
103108 end
104109 end
0 commit comments