Forms2OleControlCollection Class

Represents collection of Forms2OleControl objects.
Inheritance Hierarchy
SystemObject
  Aspose.Words.Drawing.OleForms2OleControlCollection

Namespace:  Aspose.Words.Drawing.Ole
Assembly:  Aspose.Words (in Aspose.Words.dll) Version: 20.3
Syntax
public class Forms2OleControlCollection

The Forms2OleControlCollection type exposes the following members.

Constructors
  NameDescription
Public methodForms2OleControlCollection
Initializes a new instance of the Forms2OleControlCollection class
Properties
  NameDescription
Public propertyCode exampleCount
Gets count of objects in the collection.
Public propertyCode exampleItem
Gets Forms2OleControl object at specified index.
Methods
  NameDescription
Public methodEquals (Inherited from Object.)
Public methodGetHashCode (Inherited from Object.)
Public methodGetType (Inherited from Object.)
Public methodToString (Inherited from Object.)
Examples
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(MyDir + "OLE ActiveX controls.docm");

// Get the shape that contains the control
Shape shape = (Shape)doc.GetChild(NodeType.Shape, 0, true);

Assert.AreEqual("6e182020-f460-11ce-9bcd-00aa00608e01", shape.OleFormat.Clsid.ToString());

Forms2OleControl oleControl = (Forms2OleControl)shape.OleFormat.OleControl;

// Some controls contain child controls
Forms2OleControlCollection oleControlCollection = oleControl.ChildNodes;

// In this case, the child controls are 3 option buttons
Assert.AreEqual(3, oleControlCollection.Count);

Assert.AreEqual("C#", oleControlCollection[0].Caption);
Assert.AreEqual("1", oleControlCollection[0].Value);

Assert.AreEqual("Visual Basic", oleControlCollection[1].Caption);
Assert.AreEqual("0", oleControlCollection[1].Value);

Assert.AreEqual("Delphi", oleControlCollection[2].Caption);
Assert.AreEqual("0", oleControlCollection[2].Value);
See Also