com.aspose.words

Class WebExtension

  • java.lang.Object
    • com.aspose.words.WebExtension
public class WebExtension 
extends java.lang.Object

Represents a web extension object.

Example:

Shows how to add a web extension to a document.
Document doc = new Document();

// Create task pane with "MyScript" add-in, which will be used by the document,
// then set its default location.
TaskPane myScriptTaskPane = new TaskPane();
doc.getWebExtensionTaskPanes().add(myScriptTaskPane);
myScriptTaskPane.setDockState(TaskPaneDockState.RIGHT);
myScriptTaskPane.isVisible(true);
myScriptTaskPane.setWidth(300.0);
myScriptTaskPane.isLocked(true);

// If there are multiple task panes in the same docking location, we can set this index to arrange them.
myScriptTaskPane.setRow(1);

// Create an add-in called "MyScript Math Sample", which the task pane will display within.
WebExtension webExtension = myScriptTaskPane.getWebExtension();

// Set application store reference parameters for our add-in, such as the ID.
webExtension.getReference().setId("WA104380646");
webExtension.getReference().setVersion("1.0.0.0");
webExtension.getReference().setStoreType(WebExtensionStoreType.OMEX);
webExtension.getReference().setStore("English (United States)");
webExtension.getProperties().add(new WebExtensionProperty("MyScript", "MyScript Math Sample"));
webExtension.getBindings().add(new WebExtensionBinding("MyScript", WebExtensionBindingType.TEXT, "104380646"));

// Allow the user to interact with the add-in.
webExtension.isFrozen(false);

// We can access the web extension in Microsoft Word via Developer -> Add-ins.
doc.save(getArtifactsDir() + "Document.WebExtension.docx");

// Remove all web extension task panes at once like this.
doc.getWebExtensionTaskPanes().clear();

Assert.assertEquals(0, doc.getWebExtensionTaskPanes().getCount());

Property Getters/Setters Summary
WebExtensionReferenceCollectiongetAlternateReferences()
Specifies alternate references to a web extension.
WebExtensionBindingCollectiongetBindings()
Specifies a list of web extension bindings.
java.lang.StringgetId()
void
setId(java.lang.Stringvalue)
           Uniquely identifies the web extension instance in the current document.
booleanisFrozen()
void
isFrozen(booleanvalue)
           Specifies whether the user can interact with the web extension or not.
WebExtensionPropertyCollectiongetProperties()
Represents a set of web extension custom properties.
WebExtensionReferencegetReference()
Specifies the primary reference to an web extension.
 

    • Property Getters/Setters Detail

      • getBindings

        public WebExtensionBindingCollection getBindings()
        
        Specifies a list of web extension bindings.

        Example:

        Shows how to add a web extension to a document.
        Document doc = new Document();
        
        // Create task pane with "MyScript" add-in, which will be used by the document,
        // then set its default location.
        TaskPane myScriptTaskPane = new TaskPane();
        doc.getWebExtensionTaskPanes().add(myScriptTaskPane);
        myScriptTaskPane.setDockState(TaskPaneDockState.RIGHT);
        myScriptTaskPane.isVisible(true);
        myScriptTaskPane.setWidth(300.0);
        myScriptTaskPane.isLocked(true);
        
        // If there are multiple task panes in the same docking location, we can set this index to arrange them.
        myScriptTaskPane.setRow(1);
        
        // Create an add-in called "MyScript Math Sample", which the task pane will display within.
        WebExtension webExtension = myScriptTaskPane.getWebExtension();
        
        // Set application store reference parameters for our add-in, such as the ID.
        webExtension.getReference().setId("WA104380646");
        webExtension.getReference().setVersion("1.0.0.0");
        webExtension.getReference().setStoreType(WebExtensionStoreType.OMEX);
        webExtension.getReference().setStore("English (United States)");
        webExtension.getProperties().add(new WebExtensionProperty("MyScript", "MyScript Math Sample"));
        webExtension.getBindings().add(new WebExtensionBinding("MyScript", WebExtensionBindingType.TEXT, "104380646"));
        
        // Allow the user to interact with the add-in.
        webExtension.isFrozen(false);
        
        // We can access the web extension in Microsoft Word via Developer -> Add-ins.
        doc.save(getArtifactsDir() + "Document.WebExtension.docx");
        
        // Remove all web extension task panes at once like this.
        doc.getWebExtensionTaskPanes().clear();
        
        Assert.assertEquals(0, doc.getWebExtensionTaskPanes().getCount());
      • getId/setId

        public java.lang.String getId() / public void setId(java.lang.String value)
        
        Uniquely identifies the web extension instance in the current document.
      • isFrozen/isFrozen

        public boolean isFrozen() / public void isFrozen(boolean value)
        
        Specifies whether the user can interact with the web extension or not.

        Example:

        Shows how to add a web extension to a document.
        Document doc = new Document();
        
        // Create task pane with "MyScript" add-in, which will be used by the document,
        // then set its default location.
        TaskPane myScriptTaskPane = new TaskPane();
        doc.getWebExtensionTaskPanes().add(myScriptTaskPane);
        myScriptTaskPane.setDockState(TaskPaneDockState.RIGHT);
        myScriptTaskPane.isVisible(true);
        myScriptTaskPane.setWidth(300.0);
        myScriptTaskPane.isLocked(true);
        
        // If there are multiple task panes in the same docking location, we can set this index to arrange them.
        myScriptTaskPane.setRow(1);
        
        // Create an add-in called "MyScript Math Sample", which the task pane will display within.
        WebExtension webExtension = myScriptTaskPane.getWebExtension();
        
        // Set application store reference parameters for our add-in, such as the ID.
        webExtension.getReference().setId("WA104380646");
        webExtension.getReference().setVersion("1.0.0.0");
        webExtension.getReference().setStoreType(WebExtensionStoreType.OMEX);
        webExtension.getReference().setStore("English (United States)");
        webExtension.getProperties().add(new WebExtensionProperty("MyScript", "MyScript Math Sample"));
        webExtension.getBindings().add(new WebExtensionBinding("MyScript", WebExtensionBindingType.TEXT, "104380646"));
        
        // Allow the user to interact with the add-in.
        webExtension.isFrozen(false);
        
        // We can access the web extension in Microsoft Word via Developer -> Add-ins.
        doc.save(getArtifactsDir() + "Document.WebExtension.docx");
        
        // Remove all web extension task panes at once like this.
        doc.getWebExtensionTaskPanes().clear();
        
        Assert.assertEquals(0, doc.getWebExtensionTaskPanes().getCount());
      • getProperties

        public WebExtensionPropertyCollection getProperties()
        
        Represents a set of web extension custom properties.

        Example:

        Shows how to add a web extension to a document.
        Document doc = new Document();
        
        // Create task pane with "MyScript" add-in, which will be used by the document,
        // then set its default location.
        TaskPane myScriptTaskPane = new TaskPane();
        doc.getWebExtensionTaskPanes().add(myScriptTaskPane);
        myScriptTaskPane.setDockState(TaskPaneDockState.RIGHT);
        myScriptTaskPane.isVisible(true);
        myScriptTaskPane.setWidth(300.0);
        myScriptTaskPane.isLocked(true);
        
        // If there are multiple task panes in the same docking location, we can set this index to arrange them.
        myScriptTaskPane.setRow(1);
        
        // Create an add-in called "MyScript Math Sample", which the task pane will display within.
        WebExtension webExtension = myScriptTaskPane.getWebExtension();
        
        // Set application store reference parameters for our add-in, such as the ID.
        webExtension.getReference().setId("WA104380646");
        webExtension.getReference().setVersion("1.0.0.0");
        webExtension.getReference().setStoreType(WebExtensionStoreType.OMEX);
        webExtension.getReference().setStore("English (United States)");
        webExtension.getProperties().add(new WebExtensionProperty("MyScript", "MyScript Math Sample"));
        webExtension.getBindings().add(new WebExtensionBinding("MyScript", WebExtensionBindingType.TEXT, "104380646"));
        
        // Allow the user to interact with the add-in.
        webExtension.isFrozen(false);
        
        // We can access the web extension in Microsoft Word via Developer -> Add-ins.
        doc.save(getArtifactsDir() + "Document.WebExtension.docx");
        
        // Remove all web extension task panes at once like this.
        doc.getWebExtensionTaskPanes().clear();
        
        Assert.assertEquals(0, doc.getWebExtensionTaskPanes().getCount());
      • getReference

        public WebExtensionReference getReference()
        
        Specifies the primary reference to an web extension.

        Example:

        Shows how to add a web extension to a document.
        Document doc = new Document();
        
        // Create task pane with "MyScript" add-in, which will be used by the document,
        // then set its default location.
        TaskPane myScriptTaskPane = new TaskPane();
        doc.getWebExtensionTaskPanes().add(myScriptTaskPane);
        myScriptTaskPane.setDockState(TaskPaneDockState.RIGHT);
        myScriptTaskPane.isVisible(true);
        myScriptTaskPane.setWidth(300.0);
        myScriptTaskPane.isLocked(true);
        
        // If there are multiple task panes in the same docking location, we can set this index to arrange them.
        myScriptTaskPane.setRow(1);
        
        // Create an add-in called "MyScript Math Sample", which the task pane will display within.
        WebExtension webExtension = myScriptTaskPane.getWebExtension();
        
        // Set application store reference parameters for our add-in, such as the ID.
        webExtension.getReference().setId("WA104380646");
        webExtension.getReference().setVersion("1.0.0.0");
        webExtension.getReference().setStoreType(WebExtensionStoreType.OMEX);
        webExtension.getReference().setStore("English (United States)");
        webExtension.getProperties().add(new WebExtensionProperty("MyScript", "MyScript Math Sample"));
        webExtension.getBindings().add(new WebExtensionBinding("MyScript", WebExtensionBindingType.TEXT, "104380646"));
        
        // Allow the user to interact with the add-in.
        webExtension.isFrozen(false);
        
        // We can access the web extension in Microsoft Word via Developer -> Add-ins.
        doc.save(getArtifactsDir() + "Document.WebExtension.docx");
        
        // Remove all web extension task panes at once like this.
        doc.getWebExtensionTaskPanes().clear();
        
        Assert.assertEquals(0, doc.getWebExtensionTaskPanes().getCount());