Posted 20 April 2018, 4:03 am 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, 4:03 am EST
Posted 20 April 2018, 4:03 am 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, 5:58 am EST
I should also add, “style” by my definition means also removing cell merges on the sheet.
Posted 22 April 2018, 9:29 pm 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, 3:18 am EST
Works beautifully, thanks!
Posted 13 March 2019, 10:23 am 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 13 March 2019, 3:55 pm 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();
}