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 create add-ins inside the document.
Document doc = new Document();

// Create taskpane with "MyScript" add-in which will be used by the document
TaskPane myScriptTaskPane = new TaskPane();
doc.getWebExtensionTaskPanes().add(myScriptTaskPane);

// Define task pane location when the document opens
myScriptTaskPane.setDockState(TaskPaneDockState.RIGHT);
myScriptTaskPane.isVisible(true);
myScriptTaskPane.setWidth(300.0);
myScriptTaskPane.isLocked(true);
// Use this option if you have several task panes
myScriptTaskPane.setRow(1);

// Add "MyScript Math Sample" add-in which will be displayed inside task pane
WebExtension webExtension = myScriptTaskPane.getWebExtension();

// Application Id from store
webExtension.getReference().setId("WA104380646");
// The current version of the application used
webExtension.getReference().setVersion("1.0.0.0");
// Type of marketplace
webExtension.getReference().setStoreType(WebExtensionStoreType.OMEX);
// Marketplace based on your locale
webExtension.getReference().setStore(Locale.getDefault().getDisplayName());

webExtension.getProperties().add(new WebExtensionProperty("MyScript", "MyScript Math Sample"));
webExtension.getBindings().add(new WebExtensionBinding("MyScript", WebExtensionBindingType.TEXT, "104380646"));

// Use this option if you need to block web extension from any action
webExtension.isFrozen(false);

doc.save(getArtifactsDir() + "Document.WebExtension.docx");

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 create add-ins inside the document.
        Document doc = new Document();
        
        // Create taskpane with "MyScript" add-in which will be used by the document
        TaskPane myScriptTaskPane = new TaskPane();
        doc.getWebExtensionTaskPanes().add(myScriptTaskPane);
        
        // Define task pane location when the document opens
        myScriptTaskPane.setDockState(TaskPaneDockState.RIGHT);
        myScriptTaskPane.isVisible(true);
        myScriptTaskPane.setWidth(300.0);
        myScriptTaskPane.isLocked(true);
        // Use this option if you have several task panes
        myScriptTaskPane.setRow(1);
        
        // Add "MyScript Math Sample" add-in which will be displayed inside task pane
        WebExtension webExtension = myScriptTaskPane.getWebExtension();
        
        // Application Id from store
        webExtension.getReference().setId("WA104380646");
        // The current version of the application used
        webExtension.getReference().setVersion("1.0.0.0");
        // Type of marketplace
        webExtension.getReference().setStoreType(WebExtensionStoreType.OMEX);
        // Marketplace based on your locale
        webExtension.getReference().setStore(Locale.getDefault().getDisplayName());
        
        webExtension.getProperties().add(new WebExtensionProperty("MyScript", "MyScript Math Sample"));
        webExtension.getBindings().add(new WebExtensionBinding("MyScript", WebExtensionBindingType.TEXT, "104380646"));
        
        // Use this option if you need to block web extension from any action
        webExtension.isFrozen(false);
        
        doc.save(getArtifactsDir() + "Document.WebExtension.docx");
      • 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 create add-ins inside the document.
        Document doc = new Document();
        
        // Create taskpane with "MyScript" add-in which will be used by the document
        TaskPane myScriptTaskPane = new TaskPane();
        doc.getWebExtensionTaskPanes().add(myScriptTaskPane);
        
        // Define task pane location when the document opens
        myScriptTaskPane.setDockState(TaskPaneDockState.RIGHT);
        myScriptTaskPane.isVisible(true);
        myScriptTaskPane.setWidth(300.0);
        myScriptTaskPane.isLocked(true);
        // Use this option if you have several task panes
        myScriptTaskPane.setRow(1);
        
        // Add "MyScript Math Sample" add-in which will be displayed inside task pane
        WebExtension webExtension = myScriptTaskPane.getWebExtension();
        
        // Application Id from store
        webExtension.getReference().setId("WA104380646");
        // The current version of the application used
        webExtension.getReference().setVersion("1.0.0.0");
        // Type of marketplace
        webExtension.getReference().setStoreType(WebExtensionStoreType.OMEX);
        // Marketplace based on your locale
        webExtension.getReference().setStore(Locale.getDefault().getDisplayName());
        
        webExtension.getProperties().add(new WebExtensionProperty("MyScript", "MyScript Math Sample"));
        webExtension.getBindings().add(new WebExtensionBinding("MyScript", WebExtensionBindingType.TEXT, "104380646"));
        
        // Use this option if you need to block web extension from any action
        webExtension.isFrozen(false);
        
        doc.save(getArtifactsDir() + "Document.WebExtension.docx");
      • getProperties

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

        Example:

        Shows how to create add-ins inside the document.
        Document doc = new Document();
        
        // Create taskpane with "MyScript" add-in which will be used by the document
        TaskPane myScriptTaskPane = new TaskPane();
        doc.getWebExtensionTaskPanes().add(myScriptTaskPane);
        
        // Define task pane location when the document opens
        myScriptTaskPane.setDockState(TaskPaneDockState.RIGHT);
        myScriptTaskPane.isVisible(true);
        myScriptTaskPane.setWidth(300.0);
        myScriptTaskPane.isLocked(true);
        // Use this option if you have several task panes
        myScriptTaskPane.setRow(1);
        
        // Add "MyScript Math Sample" add-in which will be displayed inside task pane
        WebExtension webExtension = myScriptTaskPane.getWebExtension();
        
        // Application Id from store
        webExtension.getReference().setId("WA104380646");
        // The current version of the application used
        webExtension.getReference().setVersion("1.0.0.0");
        // Type of marketplace
        webExtension.getReference().setStoreType(WebExtensionStoreType.OMEX);
        // Marketplace based on your locale
        webExtension.getReference().setStore(Locale.getDefault().getDisplayName());
        
        webExtension.getProperties().add(new WebExtensionProperty("MyScript", "MyScript Math Sample"));
        webExtension.getBindings().add(new WebExtensionBinding("MyScript", WebExtensionBindingType.TEXT, "104380646"));
        
        // Use this option if you need to block web extension from any action
        webExtension.isFrozen(false);
        
        doc.save(getArtifactsDir() + "Document.WebExtension.docx");
      • getReference

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

        Example:

        Shows how to create add-ins inside the document.
        Document doc = new Document();
        
        // Create taskpane with "MyScript" add-in which will be used by the document
        TaskPane myScriptTaskPane = new TaskPane();
        doc.getWebExtensionTaskPanes().add(myScriptTaskPane);
        
        // Define task pane location when the document opens
        myScriptTaskPane.setDockState(TaskPaneDockState.RIGHT);
        myScriptTaskPane.isVisible(true);
        myScriptTaskPane.setWidth(300.0);
        myScriptTaskPane.isLocked(true);
        // Use this option if you have several task panes
        myScriptTaskPane.setRow(1);
        
        // Add "MyScript Math Sample" add-in which will be displayed inside task pane
        WebExtension webExtension = myScriptTaskPane.getWebExtension();
        
        // Application Id from store
        webExtension.getReference().setId("WA104380646");
        // The current version of the application used
        webExtension.getReference().setVersion("1.0.0.0");
        // Type of marketplace
        webExtension.getReference().setStoreType(WebExtensionStoreType.OMEX);
        // Marketplace based on your locale
        webExtension.getReference().setStore(Locale.getDefault().getDisplayName());
        
        webExtension.getProperties().add(new WebExtensionProperty("MyScript", "MyScript Math Sample"));
        webExtension.getBindings().add(new WebExtensionBinding("MyScript", WebExtensionBindingType.TEXT, "104380646"));
        
        // Use this option if you need to block web extension from any action
        webExtension.isFrozen(false);
        
        doc.save(getArtifactsDir() + "Document.WebExtension.docx");