Web Extensions

Web Extensions

This guide shows how to read and modify Office Add-in task pane metadata embedded in a .docx file with Aspose.Words FOSS for .NET. Aspose.Words FOSS for .NET can read and modify the web extension (Office Add-in) task panes embedded in a .docx file — the metadata that associates a document with an Office Add-in and binds it to document data — through Document.WebExtensionTaskPanes and the TaskPane/WebExtension object model.


Task Panes

Document.WebExtensionTaskPanes returns a TaskPaneCollection of TaskPane objects. Each TaskPane describes where and how an add-in’s pane is docked: DockState (a TaskPaneDockState of Right or Left), Row, Width, IsLocked, and IsVisible, plus a WebExtension property linking to the add-in itself.


Web Extension Identity and References

WebExtension identifies the add-in via Id and IsFrozen, and its Reference property (a WebExtensionReference) exposes Id, Version, Store, and StoreType (a WebExtensionStoreType such as SPCatalog, Exchange, or FileSystem) describing where the add-in is distributed from. AlternateReferences holds a WebExtensionReferenceCollection of fallback references.


Bindings and Custom Properties

WebExtension.Bindings is a WebExtensionBindingCollection of WebExtensionBinding objects, each constructed as new WebExtensionBinding(id, bindingType, appRef) and linking part of the document’s data to the add-in via a WebExtensionBindingType (Matrix, Table, or Text). WebExtension.Properties is a WebExtensionPropertyCollection of simple WebExtensionProperty name/value pairs, constructed as new WebExtensionProperty(name, value), used for add-in-specific custom settings that don’t warrant a full binding.


Collection Membership

TaskPaneCollection, WebExtensionBindingCollection, WebExtensionPropertyCollection, and WebExtensionReferenceCollection all share the same base collection behavior: Add(item), Clear(), Remove(index), GetEnumerator(), and Count.


Tips and Best Practices

  • Check TaskPane.IsVisible before assuming an add-in’s pane is currently shown to the user — a task pane can be registered but hidden.
  • WebExtensionReference.StoreType tells you where an add-in was sourced from (catalog, Exchange, file system, registry); use it to distinguish first-party from sideloaded add-ins.
  • Bindings link a specific WebExtensionBindingType (matrix, table, or plain text) to document data — check the binding type before assuming what shape of data an add-in expects.
  • Use WebExtension.Properties for simple name/value add-in configuration values rather than trying to store them elsewhere in the document.

Common Issues

IssueCauseFix
Document.WebExtensionTaskPanes is emptyThe document has no Office Add-ins registeredConfirm the source .docx actually embeds a task pane before assuming the API is broken
Can’t tell which store an add-in came fromStoreType not checkedRead WebExtensionReference.StoreType alongside Store for the full picture
Binding data doesn’t match expectationsBinding type mismatchCheck WebExtensionBinding.BindingType (Matrix, Table, Text) before consuming bound data

FAQ

How do I find all Office Add-ins registered in a document?

Enumerate Document.WebExtensionTaskPanes (a TaskPaneCollection); each TaskPane.WebExtension gives you the add-in’s identity and configuration.

Can I add a new web extension binding or property with this API?

Yes — the collections (WebExtensionBindingCollection, WebExtensionPropertyCollection, etc.) support Add(), so you can construct and add new WebExtensionBinding/WebExtensionProperty objects to an existing WebExtension.

What does WebExtensionBinding actually bind?

It links a portion of the document’s data to the add-in, using a WebExtensionBindingType (Matrix, Table, or Text) to describe the shape of that data.

How do I read custom add-in settings stored in the document?

Iterate WebExtension.Properties (a WebExtensionPropertyCollection); each WebExtensionProperty exposes a Name/Value pair.


API Reference Summary

Class / MethodDescription
Document.WebExtensionTaskPanesTaskPaneCollection of task panes registered in the document
TaskPaneOne add-in pane: DockState, Row, Width, IsVisible, IsLocked, WebExtension
WebExtensionAdd-in identity: Id, IsFrozen, Reference, Bindings, Properties
WebExtensionReferenceAdd-in source: Id, Version, Store, StoreType
WebExtensionBindingLinks document data to the add-in via WebExtensionBindingType
WebExtensionPropertyCustom add-in setting as a Name/Value pair

See Also