none
Set column width in Excel using Javascript API RRS feed

  • Question

  • How can I set the Column width using the new Excel Add-ins JavaScript API? The active spreadsheet already has data in it.

    Friday, March 11, 2016 12:19 AM

Answers

  • Hi Thomas,

    >> How can I set the Column width using the new Excel Add-ins JavaScript API?

    I have checked the Excel add-ins API, and I think there is no such api could achieve your requirement.

    If this is a feature you want to include in future version, I suggest you submit a feedback in the link below:

    http://officespdev.uservoice.com

    Best Regards,

    Edward


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.


    Monday, March 14, 2016 1:58 AM

All replies

  • Hi Thomas,

    >> How can I set the Column width using the new Excel Add-ins JavaScript API?

    I have checked the Excel add-ins API, and I think there is no such api could achieve your requirement.

    If this is a feature you want to include in future version, I suggest you submit a feedback in the link below:

    http://officespdev.uservoice.com

    Best Regards,

    Edward


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.


    Monday, March 14, 2016 1:58 AM
  • Hi Edward,

    I need to do two things to my Excel 2016 Add-in.  1) As per Thomas above, I need to change the width of several columns in my javascript and 2) I need to set a few columns to Date only format.

    Is this possible?

    Thanks,

    George

    Friday, March 18, 2016 2:25 PM
  • Hi George,

    As my above reply, changing width of columns is not supported, I suggest you submit a feedback.

    For the second issue, I suggest you post a new thread for this, and then more community members would jump in to help you.

    Best Regards,

    Edward 


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.


    Saturday, March 19, 2016 5:26 AM
  • The following Typescript code written in an Excel Add-in adjusts the column width.

    var sheet: Excel.Worksheet = ctx.workbook.worksheets.getActiveWorksheet();
    var range: Excel.Range = sheet.getRange("A:A");
    range.format.columnWidth = 50;

    Kind Regards

    Danny

    Saturday, May 27, 2017 11:07 AM
  • The following Typescript code written in an Excel Add-in adjusts the column width.

    var sheet: Excel.Worksheet = ctx.workbook.worksheets.getActiveWorksheet();
    var range: Excel.Range = sheet.getRange("A:A");
    range.format.columnWidth = 50;

    Kind Regards

    Danny

    Danny,

    Unfortunately, range.format.columnWidth doesn't change column width for some reason. Moreover, any code following that line stops giving any effect on range (e.g. value or fill color doesn't change anymore).

    Tuesday, September 25, 2018 12:59 PM