Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Regression: ArgumentError in extract_coordinate in 2.8.1 #489

Closed
andykelk opened this issue Jan 22, 2019 · 2 comments
Closed

Regression: ArgumentError in extract_coordinate in 2.8.1 #489

andykelk opened this issue Jan 22, 2019 · 2 comments

Comments

@andykelk
Copy link

andykelk commented Jan 22, 2019

Steps to reproduce

Attached test case and sample file

test.xlsx
test-case.rb.txt

Issue

When opening an XLSX spreadsheet with hyperlinks, receive an ArgumentError in lib/roo/utils.rb:20

I've tried cutting back the file to find the offending row but it starts working after a while and seems to be somewhat inconsistent in reproduction with the same visible data in Excel.

File was written by Excel for Mac v16.21

System configuration

Roo version: 2.8.1. The issue appeared when updating to 2.8.0

Ruby version: ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-darwin17]

@andykelk
Copy link
Author

Having looked at this further, the issue appears to be with the definition of a hyperlink. Excel writes the hyperlink once and then references the same link across a range:

<hyperlink ref="A2:A5" r:id="rId1"

This raises an exception in Roo::Utils::extract_coordinate as it contains a : rather than just alphanumeric characters.

The previous implementation in 2.7.1 (Roo::Utils::split_coordinate) used a regex to just grab the first coordinate and would ignore the second coordinate in the range.

I'm probably not intimate enough with the internals of XLSX documents to propose a fix but the previous implementation certainly seemed to work for our purposes although it seems it would have missed the hyperlink being associated with all but the first cell in the range.

I tested the attached patch which solved the issue for me but seems like a fairly ugly hack.
fix_hyperlink_range.patch.txt

chopraanmol1 added a commit to chopraanmol1/roo that referenced this issue Jan 23, 2019
chopraanmol1 added a commit to chopraanmol1/roo that referenced this issue Jan 23, 2019
@chopraanmol1
Copy link
Member

@andykelk Thank you for reporting this issue in a detailed manner.

aravindm pushed a commit to chobiwa/roo that referenced this issue Jun 18, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants