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

Add simple merge cells capability #37

Closed
wants to merge 4 commits into from
Closed

Add simple merge cells capability #37

wants to merge 4 commits into from

Conversation

mchapman
Copy link
Contributor

I needed this for a hack at the weekend. Didn't have time to do any tests, but it may save someone a few minutes.

@SheetJSDev
Copy link
Contributor

@mchapman thanks :) A similar request was made for xlsx: SheetJS/sheetjs#41

I actually have a test file to play with: https://github.com/SheetJS/test_files/blob/master/merge_cells.xls

How are the other cells in a merge represented? Using the aforementioned file, how are cells B1, A2, B2, C2, D2, B3, and B4 stored?

@mchapman
Copy link
Contributor Author

I didn't do anything in js-xls apart from return the array of merged cells,
and left what to do with them up to the calling app. In my case (
https://github.com/mchapman/getTriples/blob/master/server.js line 46) I
copied the contents of the top left cell into the other cells, but if you
were trying to represent the data in a spreadsheet-like style this would be
completely inappropriate.

On 10 March 2014 12:35, SheetJSDev [email protected] wrote:

@mchapman https://github.com/mchapman thanks :) A similar request was
made for xlsx: SheetJS/sheetjs#41SheetJS/sheetjs#41

I actually have a test file to play with:
https://github.com/SheetJS/test_files/blob/master/merge_cells.xls

How are the other cells in a merge represented? Using the aforementioned
file, how are cells B1, A2, B2, C2, D2, B3, and B4 stored?

Reply to this email directly or view it on GitHubhttps://github.com/SheetJS/sheetjs/pull/37#issuecomment-37177396
.

@SheetJSDev
Copy link
Contributor

This looks OK, but I think it should save as range structures. See parse_Ref8U (which appears to be the same structure as Ref8) for what the range object looks like.

That way, your code simplifies greatly: for example, https://github.com/mchapman/getTriples/blob/master/server.js#L50 becomes XLS.utils.encode_cell(range.s)

@SheetJSDev
Copy link
Contributor

@mchapman just saw the update. Looks good. If you can squash the two commits to one, I'll merge :)

@mchapman
Copy link
Contributor Author

This was getting messy, so have started from scratch in #38

@mchapman mchapman closed this Mar 22, 2014
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.

None yet

2 participants