Alaa Abuiteiwi
Alaa Abuiteiwi

Reputation: 101

Is there a way to force older versions of Excel Api (api version<=1.1) to fit column width to content?

I'm currently working on an Addin for Excel, I use Javascript and JQuery in the code, and I am using the latest version of the Office JS library by the date of this question. The issue I'm facing is a compatibility issue as the sheet.getUsedRange().format.autofitColumns(); line works with Excel versions that have ExcelApi 1.2 or later, but I can't manage to do the same thing with earlier versions, is there a workaround to get this done?

Upvotes: 0

Views: 82

Answers (1)

Michael Zlatkovsky
Michael Zlatkovsky

Reputation: 8670

The availability of APIs is based on the native C++ code of the host. For an API like autofitColumns() -- and pretty much any other APIs that weren't part of the original ExcelApi 1.1 offering of Office 2016 -- that unfortunately means that there is no workaround. You can specify the requirement sets in your manifest, and/or do dynamic checks for Office.context.requirements.isSetSupported(...) for a light-up scenario, but there is nothing you can do to make an API work if the host doesn't support it.

Upvotes: 1

Related Questions