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
How to write merged Cells #92
Comments
@longweiquan thanks for reaching out! Right now merged cells are not being written. I would accept a contribution :) The code would look like this:
I have not added it yet because, to be honest, I'm not particularly happy with the current representation of merged cells. It's strange because certain operations are not well-defined (for example, if you merge A1:B2, what should happen if you try to access cell A2, B1, or B2?). @clayzermk1 @mchapman any thoughts on the issue of merged cells representation? |
@SheetJSDev, thank you for your rapid reply. Suggestion, maybe you can keep the same behavior as Excel do. When cells are merged in Excel, only the top-left cell is left and the others are deleted. This concern the manipulation of the Sheets object, maybe you can even write some utils for merging cells to avoid wrong usage. |
@SheetJSDev I think what @longweiquan said about being consistent with Excel is a rational thing to do. Shouldn't be that bad to check for an existing merge range in a proposed merge range, remove the existing range, and then create the proposed range (did I interpret that correctly?). |
@clayzermk1, thank you for the interpretation :), that's exactly what I mean. |
This is the proposed solution from @SheetJSDev to write merged cells. It seems to work well enough for what I need. see: SheetJS#92 Signed-off-by: Patrick Wagstrom <patrick@wagstrom.net>
So the merging is still not possible? |
Merging was added in 0.7.10. #416 (comment) has an example in nodejs. https://jsfiddle.net/w8t0g8xn/ is a fiddle |
First of all, thank you for sharing this great library. I have a question about how to create the merged cells while writing files. I found the attribute Sheets['!merges'] while reading the files with cells, the same attributes don't work for writing.
The text was updated successfully, but these errors were encountered: