Performance of formatting question.

5 posts, 0 answers
  1. Christopher
    Christopher avatar
    42 posts
    Member since:
    Jan 2017

    Posted 26 Jun 2017 Link to this post

    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?
  2. Christopher
    Christopher avatar
    42 posts
    Member since:
    Jan 2017

    Posted 26 Jun 2017 in reply to Christopher Link to this post

    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.

  3. Michelle
    Michelle avatar
    46 posts
    Member since:
    Feb 2015

    Posted 27 Jul 2017 Link to this post

    Yes, I came to exactly the same conclusion as well after implementing it the slow way the first time around.
  4. Christopher
    Christopher avatar
    42 posts
    Member since:
    Jan 2017

    Posted 27 Jul 2017 in reply to Michelle Link to this post

    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);
  5. Veselin Tsvetanov
    Admin
    Veselin Tsvetanov avatar
    1201 posts

    Posted 31 Jul 2017 Link to this post

    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.
Back to Top