xlsx-populate
xlsx-populate copied to clipboard
Copying style of one cell/range to another
The ability to copy the full style of one cell (or range) to another is a key feature when data is automatically populated in a sheet.
Just iterating over the recognized (named) styles and getting/setting their value is not an option because (a) it will explode the style information, when the source cell shares style information with a row/other cells, and (b) sometimes it doesn't work.
I would also like to know how to approach this issue.
Related to this is that for some reason
(StyleSheet.js Line: 79) sourceXfNode.attributes.applyFill
is not present in a cell which has fill data so when checking cell.styl(any style query) the fill is wiped.
File was saved with LibreOffice and format was .xlsx.
I added a hacky solution that checks for:
(sourceXfNode.attributes.applyFill || sourceXfNode.attributes.fillId)
in StyleSheet.js Line: 79. Which solved that particular issue.
I'm also curious about how to safely copy all cell-style attributes since this breaks the style on a mere query.