Configure multi sheets options/listeners

Posted by: davide.vago on 27 February 2020, 12:13 pm EST

    • Post Options:
    • Link

    Posted 27 February 2020, 12:13 pm EST

    Good morning/afternoon

    I’m currently looking to customise the options of a list of sheets imported into a Workbook instance but I’m struggling to find a clean solution to attach global config and listeners to each sheet.

    Do you have a way to set up things like: gridline, selectionBorderColor , frozenlineColor as default for each Sheets?

    This applies also to the Events listeners.

    I was thinking about a work around way (that does suck a bit) to get the list of sheets and then apply via a loop these configs but I can’t even find a method to get the all list of sheets, infact I just found these:

    • getSheet
    • getSheetCount
    • getSheetFromName
    • getSheetIndex
  • Posted 28 February 2020, 1:06 am EST

    Hi Davide,

    We could set the gridline color and selection border color for the sheet using the following CSS:

    .gc-gridlineColor {
      border-color: seagreen;
    }
    
    .gc-selection {
      border-color: red;
    }
    

    but for frozenlineColor we need to set the frozenlineColor of the worksheet. To iterate over all the sheets we could use the sheets property of workbook. Please refer to the following code snippet:

    spread.sheets.forEach((sheet) => {
        sheet.options.frozenlineColor = "cyan";
    });
    

    Regards

    Sharad

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels