This is a migrated thread and some comments may be shown as answers.

Performance of formatting question.

4 Answers 100 Views
Spreadsheet
This is a migrated thread and some comments may be shown as answers.
Christopher
Top achievements
Rank 2
Iron
Christopher asked on 26 Jun 2017, 09:18 PM
Generally speaking, is it just as performant to apply formatting and validation settings cell by cell, or is it better to apply it by range? Or are they functionally the same and there wouldn't necessarily be an operational performance difference?

4 Answers, 1 is accepted

Sort by
0
Christopher
Top achievements
Rank 2
Iron
answered on 27 Jun 2017, 01:23 AM

Well, found this out the hard way. Multiple sheet range calls are far slower than defining the styling upon sheet insert, that is, within the sheet config/json itself. Way faster loading it initially from config than applying styles to the sheet after the insert.

0
Michelle
Top achievements
Rank 1
answered on 28 Jul 2017, 02:04 AM
Yes, I came to exactly the same conclusion as well after implementing it the slow way the first time around.
0
Christopher
Top achievements
Rank 2
Iron
answered on 28 Jul 2017, 04:36 AM

Just an FYI, while the initial config is very fast, I did find a good workaround if you need to apply styling post-load.

The trick is to leverage the sheet's "suspendChanges" function. So your workflow would look something like:

sheet.suspendChanges(true);
//apply a bunch of changes to values and styles
//...
sheet.suspendChanges(false);
0
Veselin Tsvetanov
Telerik team
answered on 31 Jul 2017, 11:46 AM
Hello Christopher,

Using the suspendChanges() method, when applying multiple changes in a Spreadsheet Sheet is a viable approach to improve performance when applying multiple changes to values and styling. However, as this method is internally used (and therefore, not documented), I would suggest you to use the Sheet.batch() method instead. Under the hood it will do exactly the same as what is done in the suggested snippet.

Regards,
Veselin Tsvetanov
Progress Telerik
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
Spreadsheet
Asked by
Christopher
Top achievements
Rank 2
Iron
Answers by
Christopher
Top achievements
Rank 2
Iron
Michelle
Top achievements
Rank 1
Veselin Tsvetanov
Telerik team
Share this question
or