An Office service that supports add-ins to interact with objects in Office client applications.
Hi @Rajat Bharadwaj
Thank you for posting your question in the Microsoft Q&A forum.
When using Office.context.document.getFileAsync(Office.FileType.Compressed, …) in Word, the returned DOCX package may sometimes be missing the word/webextensions folder. As a result, any add‑in settings stored via Office.context.document.settings which are persisted into webextension1.xml won’t appear in the Base64 output. This behavior has been reported in Custom settings are not present in files retrieved using getFileAsync() · Issue #6434 · OfficeDev/o…
Currently, there isn’t an Office.js API option to force inclusion of the webextensions folder when the host application omits it. If you depend on those settings, here are some practical workarounds:
1.Trigger a real document save before export
-After a manual save (File > Save), the settings are correctly included in the package.
-The issue report also notes it does not appear in Office on the web, so Word for web may work normally.
2.Send metadata separately from the document
If your backend requires both the document and metadata, consider sending:
-Base64 of the document from getFileAsync.
-A separate JSON payload containing your metadata instead of embedding it in settings.
This avoids dependency on Word’s packaging internals, which can change across versions.
Reference: Persist add-in state and settings - Office Add-ins | Microsoft Learn.
3.Use alternative storage inside the document
Instead of relying on webextensions, metadata can be stored in:
-Custom document properties
-Custom XML parts
-Hidden content controls
These approaches store data in standard OOXML document parts, which are included in the document package generated by Word.
Reference: Office.Document interface - Office Add-ins | Microsoft Learn.
I hope this clarifies the behavior and available options.
If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
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.