Set width to all the column

Posted by: syedmudhasir.m on 18 September 2019, 8:53 am EST

    • Post Options:
    • Link

    Posted 18 September 2019, 8:53 am EST

    Hi,

    How to set width to all the column at the same time without using loop which by default taking to much time.

    for (let j = 0; j < columncount; j++) {

    activeSheet.setColumnWidth(j, 25.0, GC.Spread.Sheets.SheetArea.viewport)

    }

    Thanks in advance.

  • Posted 19 September 2019, 5:48 am EST

    Hi,

    To resize multiple columns at once, you may use the “resizeColumn” command. Please refer to the following code snippet and the sample demonstrating the same:

    spread.commandManager().execute({
        cmd: "resizeColumn",
        sheetName: sheet.name(),
        columns: columns,
        size: 120,
        rowHeader: false
      });
    

    https://codesandbox.io/s/spread-js-starter-xjjbh

    Also, while making multiple changes to sheet, it is recommended to use the suspendPaint/resumePaint to improve performance. Please refer to the following docuement: http://help.grapecity.com/spread/SpreadSheets12/webframe.html#UsingsuspendPaintandresumePaint.html

    Regards

    Sharad

  • Posted 27 September 2019, 1:21 am EST

    Thanks, I have also tried a few things like :

    1: using ‘suspendPaint()’ and ‘resumePaint()’

    2: bindCols.push({ id: colIndex, name: temp, size: 20 })

    activeSheet.bindColumns(bindCols);

    both had the same effects and worked for me.

Need extra support?

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

Learn More

Forum Channels