com.aspose.words

Class WebExtensionBinding

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

Specifies a binding relationship between a web extension and the data in the document.

Constructor Summary
WebExtensionBinding(java.lang.Stringid, intbindingType, java.lang.StringappRef)
Creates web extension binding with specified parameters.
 
Property Getters/Setters Summary
java.lang.StringgetAppRef()
void
setAppRef(java.lang.Stringvalue)
           Specifies the binding key used to map the binding entry in this list with the bound data in the document.
intgetBindingType()
void
setBindingType(intvalue)
           Specifies the binding type. The value of the property is WebExtensionBindingType integer constant.
java.lang.StringgetId()
void
setId(java.lang.Stringvalue)
           Specifies the binding identifier.
 

    • Constructor Detail

      • WebExtensionBinding

        public WebExtensionBinding(java.lang.String id, int bindingType, java.lang.String appRef)
        Creates web extension binding with specified parameters.
        Parameters:
        id - Binding identifier.
        bindingType - A WebExtensionBindingType value. Binding type.
        appRef - Binding key used to map the binding entry in this list with the bound data in the document.

        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 Detail

      • getAppRef/setAppRef

        public java.lang.String getAppRef() / public void setAppRef(java.lang.String value)
        
        Specifies the binding key used to map the binding entry in this list with the bound data in the document.
      • getBindingType/setBindingType

        public int getBindingType() / public void setBindingType(int value)
        
        Specifies the binding type. The value of the property is WebExtensionBindingType integer constant.
      • getId/setId

        public java.lang.String getId() / public void setId(java.lang.String value)
        
        Specifies the binding identifier.