Skip to content

Commit

Permalink
Updated the XPATH query to "/xmlns:worksheet/xmlns:hyperlinks/xmlns:h…
Browse files Browse the repository at this point in the history
…yperlink[id]" to avoid the previous error "NoMethodError (undefined method `text' for nil:NilClass)"
  • Loading branch information
rui-castro committed Mar 30, 2014
1 parent 75bc50a commit d69d198
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/roo/excelx.rb
Original file line number Diff line number Diff line change
Expand Up @@ -538,8 +538,8 @@ def read_hyperlinks(sheet=nil)
rels = Hash[rels_doc.xpath("/xmlns:Relationships/xmlns:Relationship").map do |r|
[r.attribute('Id').text, r]
end]
@sheet_doc[n].xpath("/xmlns:worksheet/xmlns:hyperlinks/xmlns:hyperlink").each do |h|
if h.attribute('id') && rel_element = rels[h.attribute('id').text]
@sheet_doc[n].xpath("/xmlns:worksheet/xmlns:hyperlinks/xmlns:hyperlink[id]").each do |h|
if rel_element = rels[h.attribute('id').text]
row,col = Roo::Base.split_coordinate(h.attributes['ref'].to_s)
@hyperlink[sheet] ||= {}
@hyperlink[sheet][[row,col]] = rel_element.attribute('Target').text
Expand Down

0 comments on commit d69d198

Please sign in to comment.