xlsx-populate icon indicating copy to clipboard operation
xlsx-populate copied to clipboard

Copying style of one cell/range to another

Open thejonan opened this issue 4 years ago • 2 comments

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.

thejonan avatar Apr 11 '20 08:04 thejonan

I would also like to know how to approach this issue.

davidconvista avatar Jul 03 '20 11:07 davidconvista

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.

oskfan avatar Dec 18 '20 12:12 oskfan