com.aspose.words
Class Forms2OleControlCollection
java.lang.Object
com.aspose.words.Forms2OleControlCollection
public class Forms2OleControlCollection
- extends java.lang.Object
Represents collection of Forms2OleControl objects.
Example:
Shows how to access an OLE control embedded in a document and its child controls.
// Open a document that contains a Microsoft Forms OLE control with child controls
Document doc = new Document(getMyDir() + "Shape.Ole.ControlCollection.docm");
// Get the shape that contains the control
Shape shape = (Shape) doc.getChild(NodeType.SHAPE, 0, true);
Assert.assertEquals(shape.getOleFormat().getClsid().toString(), "6e182020-f460-11ce-9bcd-00aa00608e01");
Forms2OleControl oleControl = (Forms2OleControl) shape.getOleFormat().getOleControl();
// Some controls contain child controls
Forms2OleControlCollection oleControlCollection = oleControl.getChildNodes();
// In this case, the child controls are 3 option buttons
Assert.assertEquals(oleControlCollection.getCount(), 3);
Assert.assertEquals(oleControlCollection.get(0).getCaption(), "C#");
Assert.assertEquals(oleControlCollection.get(0).getValue(), "1");
Assert.assertEquals(oleControlCollection.get(1).getCaption(), "Visual Basic");
Assert.assertEquals(oleControlCollection.get(1).getValue(), "0");
Assert.assertEquals(oleControlCollection.get(2).getCaption(), "Delphi");
Assert.assertEquals(oleControlCollection.get(2).getValue(), "0");
Forms2OleControlCollection
public Forms2OleControlCollection()
-
Property Getters/Setters Detail |
getCount | |
public int getCount()
|
-
Gets count of objects in the collection.
Example:
Shows how to access an OLE control embedded in a document and its child controls.
// Open a document that contains a Microsoft Forms OLE control with child controls
Document doc = new Document(getMyDir() + "Shape.Ole.ControlCollection.docm");
// Get the shape that contains the control
Shape shape = (Shape) doc.getChild(NodeType.SHAPE, 0, true);
Assert.assertEquals(shape.getOleFormat().getClsid().toString(), "6e182020-f460-11ce-9bcd-00aa00608e01");
Forms2OleControl oleControl = (Forms2OleControl) shape.getOleFormat().getOleControl();
// Some controls contain child controls
Forms2OleControlCollection oleControlCollection = oleControl.getChildNodes();
// In this case, the child controls are 3 option buttons
Assert.assertEquals(oleControlCollection.getCount(), 3);
Assert.assertEquals(oleControlCollection.get(0).getCaption(), "C#");
Assert.assertEquals(oleControlCollection.get(0).getValue(), "1");
Assert.assertEquals(oleControlCollection.get(1).getCaption(), "Visual Basic");
Assert.assertEquals(oleControlCollection.get(1).getValue(), "0");
Assert.assertEquals(oleControlCollection.get(2).getCaption(), "Delphi");
Assert.assertEquals(oleControlCollection.get(2).getValue(), "0");
-
Gets Forms2OleControl object at specified index.
Example:
Shows how to access an OLE control embedded in a document and its child controls.
// Open a document that contains a Microsoft Forms OLE control with child controls
Document doc = new Document(getMyDir() + "Shape.Ole.ControlCollection.docm");
// Get the shape that contains the control
Shape shape = (Shape) doc.getChild(NodeType.SHAPE, 0, true);
Assert.assertEquals(shape.getOleFormat().getClsid().toString(), "6e182020-f460-11ce-9bcd-00aa00608e01");
Forms2OleControl oleControl = (Forms2OleControl) shape.getOleFormat().getOleControl();
// Some controls contain child controls
Forms2OleControlCollection oleControlCollection = oleControl.getChildNodes();
// In this case, the child controls are 3 option buttons
Assert.assertEquals(oleControlCollection.getCount(), 3);
Assert.assertEquals(oleControlCollection.get(0).getCaption(), "C#");
Assert.assertEquals(oleControlCollection.get(0).getValue(), "1");
Assert.assertEquals(oleControlCollection.get(1).getCaption(), "Visual Basic");
Assert.assertEquals(oleControlCollection.get(1).getValue(), "0");
Assert.assertEquals(oleControlCollection.get(2).getCaption(), "Delphi");
Assert.assertEquals(oleControlCollection.get(2).getValue(), "0");
See Also:
Aspose.Words Documentation - the home page for the Aspose.Words Product Documentation.
Aspose.Words Support Forum - our preferred method of support.