Forms2OleControlCollection Class

Represents collection of Forms2OleControl objects.

ExpandedInheritance Hierarchy

SystemObject
  Aspose.Words.Drawing.OleForms2OleControlCollection

Namespace:  Aspose.Words.Drawing.Ole
Assembly:  Aspose.Words (in Aspose.Words.dll) Version: 21.11.0

ExpandedSyntax

public class Forms2OleControlCollection

The Forms2OleControlCollection type exposes the following members.

ExpandedConstructors

  NameDescription
Public methodForms2OleControlCollection
Initializes a new instance of the Forms2OleControlCollection class

ExpandedProperties

  NameDescription
Public propertyCode exampleCount
Gets count of objects in the collection.
Public propertyCode exampleItem
Gets Forms2OleControl object at specified index.

ExpandedMethods

  NameDescription
Public methodEquals
Determines whether the specified object is equal to the current object.
(Inherited from Object.)
Public methodGetHashCode
Serves as the default hash function.
(Inherited from Object.)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)

ExpandedExamples

Shows how to access an OLE control embedded in a document and its child controls.
Document doc = new Document(MyDir + "OLE ActiveX controls.docm");

// Shapes store and display OLE objects in the document's body.
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 OLE controls may contain child controls, such as the one in this document with three options buttons.
Forms2OleControlCollection oleControlCollection = oleControl.ChildNodes;

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);

ExpandedSee Also