Posted 20 April 2018, 1:03 pm EST
FlexSheet has applyCellsStyle(), but what is the best way to remove all cell styles from individual sheets? I would like a function clearAllCellStyles().
Is there something to accomplish this?
Forums Home / Wijmo / General Discussion
Posted by: curiosichi on 20 April 2018, 1:03 pm EST
Posted 20 April 2018, 1:03 pm EST
FlexSheet has applyCellsStyle(), but what is the best way to remove all cell styles from individual sheets? I would like a function clearAllCellStyles().
Is there something to accomplish this?
Posted 20 April 2018, 2:58 pm EST
I should also add, “style” by my definition means also removing cell merges on the sheet.
Posted 23 April 2018, 6:29 am EST
Hi,
Please refer to the following example’s clearStyle method for the same:-
https://stackblitz.com/edit/angular-b3miat?file=app%2Fapp.component.ts
~Manish
Posted 24 April 2018, 12:18 pm EST
Works beautifully, thanks!
Posted 13 March 2019, 7:23 pm EST
I may be mistaken, but this seems to no longer work. I get the error:
"Cannot set property _mergedRanges of [object Object] which has only a getter"
Is there a new way to accomplish this task?
Posted 14 March 2019, 12:55 am EST
Hi,
For version 5.20181.462+, please clear sheet._currentMergedRanges and sheet._currentStyledCells.
Please refer to the following code snippet:
clearStyle(flexSheet){
flexSheet.sheets.forEach(sheet=>{
sheet._currentStyledCells=null;
sheet._currentMergedRanges=null;
});
flexSheet.invalidate();
}