OleControl Class

Represents OLE ActiveX control.

ExpandedInheritance Hierarchy

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


public class OleControl

The OleControl type exposes the following members.


Public propertyCode exampleIsForms2OleControl
Returns true if the control is a Forms2OleControl.
Public propertyCode exampleName
Gets name of the ActiveX control.


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


Shows how to verify the properties of an ActiveX control.
Document doc = new Document(MyDir + "ActiveX controls.docx");

Shape shape = (Shape) doc.GetChild(NodeType.Shape, 0, true);
OleControl oleControl = shape.OleFormat.OleControl;

Assert.AreEqual(null, oleControl.Name);

if (oleControl.IsForms2OleControl)
    Forms2OleControl checkBox = (Forms2OleControl) oleControl;
    Assert.AreEqual("Первый", checkBox.Caption);
    Assert.AreEqual("0", checkBox.Value);
    Assert.AreEqual(true, checkBox.Enabled);
    Assert.AreEqual(Forms2OleControlType.CheckBox, checkBox.Type);
    Assert.AreEqual(null, checkBox.ChildNodes);

ExpandedSee Also