Change size of spreadsheet dynamically

Posted by: gautam.kumar on 27 April 2021, 8:05 pm EST

  • Posted 27 April 2021, 8:05 pm EST

    I am trying to give the spread component size both initial width and height.

    On the initial load, it look fine but when I resize the component(changing width of spread), the spread component does not resize. It still give assigned initial width and height.
    Is there a method / function I can call to resize it properly?
    Thanks
  • Replied 28 April 2021, 4:48 pm EST

    Hi Gautam,

    You may use the refresh method after changing the size of the spreading host container. Please refer to the following code snippet and attached a sample that demonstrates the same.



    resize = () => {
    this.spread.getHost().style.width = "50%";
    this.spread.refresh();
    };


    sample: https://codesandbox.io/s/jolly-bush-6zcpx?file=/src/index.js:1151-1249

    API References:

    refresh: https://www.grapecity.com/spreadjs/docs/v14/online/SpreadJS~GC.Spread.Sheets.Workbook~refresh.html

    Regards,
    Avinash
Need extra support?

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

Learn More

Forum Channels