How to write merged Cells #92
Labels
No Label
DBF
Dates
Defined Names
Features
Formula
HTML
Images
Infrastructure
Integration
International
ODS
Operations
Performance
PivotTables
Pro
Protection
Read Bug
SSF
SYLK
Style
Write Bug
good first issue
No Milestone
No Assignees
1 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: sheetjs/sheetjs#92
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
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.
@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.
So the merging is still not possible?
Merging was added in 0.7.10. https://github.com/SheetJS/js-xlsx/issues/416#issuecomment-286932882 has an example in nodejs. https://jsfiddle.net/w8t0g8xn/ is a fiddle