Aspose::Words::WebExtensions::TaskPaneCollection class
Contents
[
Hide
]TaskPaneCollection class
Specifies a list of persisted task pane objects. To learn more, visit the Work with Office Add-ins documentation article.
class TaskPaneCollection : public Aspose::Words::WebExtensions::BaseWebExtensionCollection<System::SharedPtr<Aspose::Words::WebExtensions::TaskPane>>
Methods
Method | Description |
---|---|
GetType() const override | |
Is(const System::TypeInfo&) const override | |
SetTemplateWeakPtr(uint32_t) override | |
static Type() |
Examples
Shows how to add a web extension to a document.
auto doc = MakeObject<Document>();
// Create task pane with "MyScript" add-in, which will be used by the document,
// then set its default location.
auto myScriptTaskPane = MakeObject<TaskPane>();
doc->get_WebExtensionTaskPanes()->Add(myScriptTaskPane);
myScriptTaskPane->set_DockState(TaskPaneDockState::Right);
myScriptTaskPane->set_IsVisible(true);
myScriptTaskPane->set_Width(300);
myScriptTaskPane->set_IsLocked(true);
// If there are multiple task panes in the same docking location, we can set this index to arrange them.
myScriptTaskPane->set_Row(1);
// Create an add-in called "MyScript Math Sample", which the task pane will display within.
SharedPtr<WebExtension> webExtension = myScriptTaskPane->get_WebExtension();
// Set application store reference parameters for our add-in, such as the ID.
webExtension->get_Reference()->set_Id(u"WA104380646");
webExtension->get_Reference()->set_Version(u"1.0.0.0");
webExtension->get_Reference()->set_StoreType(WebExtensionStoreType::OMEX);
webExtension->get_Reference()->set_Store(System::Globalization::CultureInfo::get_CurrentCulture()->get_Name());
webExtension->get_Properties()->Add(MakeObject<WebExtensionProperty>(u"MyScript", u"MyScript Math Sample"));
webExtension->get_Bindings()->Add(MakeObject<WebExtensionBinding>(u"MyScript", WebExtensionBindingType::Text, u"104380646"));
// Allow the user to interact with the add-in.
webExtension->set_IsFrozen(false);
// We can access the web extension in Microsoft Word via Developer -> Add-ins.
doc->Save(ArtifactsDir + u"Document.WebExtension.docx");
// Remove all web extension task panes at once like this.
doc->get_WebExtensionTaskPanes()->Clear();
ASSERT_EQ(0, doc->get_WebExtensionTaskPanes()->get_Count());
See Also
- Class BaseWebExtensionCollection
- Namespace Aspose::Words::WebExtensions
- Library Aspose.Words for C++