An Office service that supports add-ins to interact with objects in Office client applications.
Hello Roman Tremb
Thank you for reaching out to the Q&A forum and sharing your question with us.
I tested the code you provided in my own environment, and it actually works well. However, I want to clarify that my testing was not done through a sideloaded add-in using office-addin-debugging. Instead, I tested the exact same logic directly inside the ScriptLab add-in on both Word Desktop and Word on the web, and the API behaved as expected there.
Because of that, it’s possible the behavior difference you’re seeing is due to environment differences (for example: sideload dev mode, hosting frame timing, or WebView environment). I can’t say for sure without fully replicating your exact dev setup, but it’s a possible factor.
I also added a quick test for: Office.context.requirements.isSetSupported('TaskPaneApi', '1.1');
and tried wrapping setWidth(480) with a small setTimeout() just to confirm whether timing affects behavior. In my tests, both worked normally.
Additionally, I noticed in your snippet there is a small typo: you have "tr" at the beginning, I assume that was supposed to be "try".
It’s also possible that in your actual project there may be additional logic surrounding that block that could influence when or how setWidth() gets called.
Since this might be related to a specific environment or a recent regression, I recommend also asking on the OfficeDev GitHub for better investigation.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.