Column width and column rect showing different size for same column/cell

Posted by: rpatel on 23 October 2018, 8:11 pm EST

    • Post Options:
    • Link

    Posted 23 October 2018, 8:11 pm EST - Updated 3 October 2022, 2:04 am EST

    Hi,

    I have to add functionality in spreadsheet js when user provide size in input box and set size to whole column. For implementing, I have using below command for set column width :

    sheet.setColumnWidth(_columnIndex, _columnSize, GC.Spread.Sheets.SheetArea.colHeader);
    

    When I fetching column width size, I am using below command :

    spread.getActiveSheet().getColumnWidth(_columnIndex, GC.Spread.Sheets.SheetArea.viewport)
    

    It’s working fine to set and get column width, Problem is that when I set column width example : 400 and check column size on web browser it’s showing different number like : 360

    I have attached screenshot which measure size of column.

    One more thing, would you please tell me what is measure parameter of getCellRect() and getColumnWidth() methods. Means both method return same width parameter of a cell but have different value.

    Regards,

    Ravish Patel

  • Posted 24 October 2018, 7:13 pm EST

    Hello Ravish,

    The cell rectangle is a component in cell, it’s width will always be less than the column width. The coordinates of a cell rectangle are not exactly the corners of the cell because it is inside a cell.

    Thanks,

    Deepak Sharma

  • Posted 24 October 2018, 11:18 pm EST

    Thanks Deepak,

    Can you please tell me How I can able to verify column width from setColumn() method with web user browser interface? like if I set 400 size to column width so which way I can verify/check/measure column width in UI browser.

    Regards,

    Ravish

  • Posted 25 October 2018, 10:39 pm EST

    Hello,

    You can use the width() method of the cell. For example:

    var colwidth = activeSheet.getCell(1, 2).width();

    Thanks,

    Deepak Sharma

Need extra support?

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

Learn More

Forum Channels