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

Expand merged cells to fill the range #171

Merged
merged 6 commits into from
Mar 23, 2015
Merged

Conversation

tmjbradley
Copy link
Contributor

When reading a worksheet with merged cells the default behaviour is to have the value in the top left cell and the remaining cells be empty. Being able to expand the merged cells to duplicate the value into all cells in the range can be helpful.

@@ -121,10 +122,30 @@ def extract_hyperlinks(relationships)
end

def extract_cells(relationships)
Hash[doc.xpath("/worksheet/sheetData/row/c").map do |cell_xml|
if @options[:expand_merged_cells]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you extract this block into separate method?

@simonoff
Copy link
Member

simonoff commented Feb 6, 2015

Would be great to have some test case for this new feature.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.58%) to 92.19% when pulling 2f0a2e3 on tmjbradley:master into c3fbd19 on roo-rb:master.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.71%) to 92.05% when pulling 80e264b on tmjbradley:master into c3fbd19 on roo-rb:master.

1 similar comment
@coveralls
Copy link

Coverage Status

Coverage decreased (-0.71%) to 92.05% when pulling 80e264b on tmjbradley:master into c3fbd19 on roo-rb:master.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.04%) to 92.73% when pulling 8139cc0 on tmjbradley:master into c3fbd19 on roo-rb:master.

1 similar comment
@coveralls
Copy link

Coverage Status

Coverage decreased (-0.04%) to 92.73% when pulling 8139cc0 on tmjbradley:master into c3fbd19 on roo-rb:master.

@tmjbradley
Copy link
Contributor Author

Added tests with the option set and unset, and refactored out into a separate method.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.04%) to 92.73% when pulling 4042f4a on tmjbradley:master into c3fbd19 on roo-rb:master.

1 similar comment
@coveralls
Copy link

Coverage Status

Coverage decreased (-0.04%) to 92.73% when pulling 4042f4a on tmjbradley:master into c3fbd19 on roo-rb:master.

@pittyacg
Copy link

Hey. Will this be usable with roo?

@tmjbradley
Copy link
Contributor Author

It's usable from my fork, it's just pending integration. Simonoff would need to comment on that.

@pittyacg
Copy link

Thanks. Working great. :)

simonoff added a commit that referenced this pull request Mar 23, 2015
Expand merged cells to fill the range
@simonoff simonoff merged commit 7082620 into roo-rb:master Mar 23, 2015
@dan-corneanu
Copy link

dan-corneanu commented Oct 11, 2016

I think we should update the README file too and document the new :expand_merged_ranges option.
I needed this feature recently and found no mention anywhere in the documentation.

Along the same lines,
if :expand_merged_ranges is not enabled, how can one read an xlsx file and retrieve information about what merged ranges are defined in a sheet?

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

Successfully merging this pull request may close these issues.

5 participants