public abstract class BaseWebExtensionCollection
Example:
Shows how to work with a document's collection of web extensions.Document doc = new Document(getMyDir() + "Web extension.docx"); Assert.assertEquals(1, doc.getWebExtensionTaskPanes().getCount()); // Print all properties of the document's web extension. WebExtensionPropertyCollection webExtensionPropertyCollection = doc.getWebExtensionTaskPanes().get(0).getWebExtension().getProperties(); Iterator<WebExtensionProperty> enumerator = webExtensionPropertyCollection.iterator(); while (enumerator.hasNext()) { WebExtensionProperty webExtensionProperty = enumerator.next(); System.out.println("Binding name: {webExtensionProperty.Name}; Binding value: {webExtensionProperty.Value}"); } // Remove the web extension. doc.getWebExtensionTaskPanes().remove(0); Assert.assertEquals(0, doc.getWebExtensionTaskPanes().getCount());
Property Getters/Setters Summary | ||
---|---|---|
int | getCount() | |
Gets the number of elements contained in the collection.
|
||
java.lang.Object | get(int index) | |
void | set(intindex, java.lang.Objectvalue) | |
Gets or sets an item at the specified index. |
Method Summary | ||
---|---|---|
void | add(java.lang.Object item) | |
void | clear() | |
Removes all elements from the collection.
|
||
java.util.Iterator | iterator() | |
Returns an enumerator that can iterate through a collection.
|
||
void | remove(int index) | |
Removes the item at the specified index from the collection.
|
public int getCount()
Example:
Shows how to work with a document's collection of web extensions.Document doc = new Document(getMyDir() + "Web extension.docx"); Assert.assertEquals(1, doc.getWebExtensionTaskPanes().getCount()); // Print all properties of the document's web extension. WebExtensionPropertyCollection webExtensionPropertyCollection = doc.getWebExtensionTaskPanes().get(0).getWebExtension().getProperties(); Iterator<WebExtensionProperty> enumerator = webExtensionPropertyCollection.iterator(); while (enumerator.hasNext()) { WebExtensionProperty webExtensionProperty = enumerator.next(); System.out.println("Binding name: {webExtensionProperty.Name}; Binding value: {webExtensionProperty.Value}"); } // Remove the web extension. doc.getWebExtensionTaskPanes().remove(0); Assert.assertEquals(0, doc.getWebExtensionTaskPanes().getCount());
public java.lang.Object get(int index) / public void set(int index, java.lang.Object value)
index
- Zero-based index of the item.Example:
Shows how to work with a document's collection of web extensions.Document doc = new Document(getMyDir() + "Web extension.docx"); Assert.assertEquals(1, doc.getWebExtensionTaskPanes().getCount()); // Print all properties of the document's web extension. WebExtensionPropertyCollection webExtensionPropertyCollection = doc.getWebExtensionTaskPanes().get(0).getWebExtension().getProperties(); Iterator<WebExtensionProperty> enumerator = webExtensionPropertyCollection.iterator(); while (enumerator.hasNext()) { WebExtensionProperty webExtensionProperty = enumerator.next(); System.out.println("Binding name: {webExtensionProperty.Name}; Binding value: {webExtensionProperty.Value}"); } // Remove the web extension. doc.getWebExtensionTaskPanes().remove(0); Assert.assertEquals(0, doc.getWebExtensionTaskPanes().getCount());
public void add(java.lang.Object item)
public void clear()
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());
public java.util.Iterator iterator()
Example:
Shows how to work with a document's collection of web extensions.Document doc = new Document(getMyDir() + "Web extension.docx"); Assert.assertEquals(1, doc.getWebExtensionTaskPanes().getCount()); // Print all properties of the document's web extension. WebExtensionPropertyCollection webExtensionPropertyCollection = doc.getWebExtensionTaskPanes().get(0).getWebExtension().getProperties(); Iterator<WebExtensionProperty> enumerator = webExtensionPropertyCollection.iterator(); while (enumerator.hasNext()) { WebExtensionProperty webExtensionProperty = enumerator.next(); System.out.println("Binding name: {webExtensionProperty.Name}; Binding value: {webExtensionProperty.Value}"); } // Remove the web extension. doc.getWebExtensionTaskPanes().remove(0); Assert.assertEquals(0, doc.getWebExtensionTaskPanes().getCount());
public void remove(int index)
index
- The zero-based index of the collection item.Example:
Shows how to work with a document's collection of web extensions.Document doc = new Document(getMyDir() + "Web extension.docx"); Assert.assertEquals(1, doc.getWebExtensionTaskPanes().getCount()); // Print all properties of the document's web extension. WebExtensionPropertyCollection webExtensionPropertyCollection = doc.getWebExtensionTaskPanes().get(0).getWebExtension().getProperties(); Iterator<WebExtensionProperty> enumerator = webExtensionPropertyCollection.iterator(); while (enumerator.hasNext()) { WebExtensionProperty webExtensionProperty = enumerator.next(); System.out.println("Binding name: {webExtensionProperty.Name}; Binding value: {webExtensionProperty.Value}"); } // Remove the web extension. doc.getWebExtensionTaskPanes().remove(0); Assert.assertEquals(0, doc.getWebExtensionTaskPanes().getCount());