Suggest approriate type for the spread object for the using typescript in react

Posted by: rehman.khaleelur on 21 April 2021, 3:55 pm EST

    • Post Options:
    • Link

    Posted 21 April 2021, 3:55 pm EST

    Hi,

    For using SpreadJS in react application using the typescript in react code, can you please suggest and appropriate type for the spread object that can be used in the initSpread() method.

    Looking forward for the reply.

    Thanks

  • Posted 22 April 2021, 9:52 pm EST

    Hi,

    SpreadJS provide the Workbook instance inside the workbookInitialized event so the type should GC.Spread.Sheets.Workbook. Please refer to the follwoing code snippet and and let su know if you face any issues.

    
     workbookInitialized(spread: GC.Spread.Sheets.Workbook) {
        // save spread instance for future references
    
        // init spread
        var sheet = spread.getActiveSheet();
        sheet.setColumnWidth(3, 120);
      }
      public render() {
        return (
          <SpreadSheets
            hostStyle={this.hostStyle}
            workbookInitialized={this.workbookInitialized}
          >
            <Worksheet />
          </SpreadSheets>
        );
      }
    
    

    Regards,

    Avinash

  • Posted 25 April 2021, 10:48 am EST

    Thanks for the help. No issues faced.

Need extra support?

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

Learn More

Forum Channels