Aspose::Words::WebExtensions::TaskPane class
Contents
[
Hide
]TaskPane class
Represents an add-in task pane object. To learn more, visit the Work with Office Add-ins documentation article.
class TaskPane : public System::Object
Methods
Method | Description |
---|---|
get_DockState() const | Specifies the last-docked location of this task pane object. |
get_IsLocked() const | Specifies whether the task pane is locked to the document in the UI and cannot be closed by the user. |
get_IsVisible() const | Specifies whether the task pane shows as visible by default when the document opens. |
get_Row() const | Specifies the index, enumerating from the outside to the inside, of this task pane among other persisted task panes docked in the same default location. |
get_WebExtension() const | Represents an web extension object. |
get_Width() const | Specifies the default width value for this task pane instance. |
GetType() const override | |
Is(const System::TypeInfo&) const override | |
set_DockState(Aspose::Words::WebExtensions::TaskPaneDockState) | Setter for Aspose::Words::WebExtensions::TaskPane::get_DockState. |
set_IsLocked(bool) | Setter for Aspose::Words::WebExtensions::TaskPane::get_IsLocked. |
set_IsVisible(bool) | Setter for Aspose::Words::WebExtensions::TaskPane::get_IsVisible. |
set_Row(int32_t) | Setter for Aspose::Words::WebExtensions::TaskPane::get_Row. |
set_Width(double) | Setter for Aspose::Words::WebExtensions::TaskPane::get_Width. |
TaskPane() | |
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
- Namespace Aspose::Words::WebExtensions
- Library Aspose.Words for C++