com.aspose.words
Class OleControl

java.lang.Object
    extended by com.aspose.words.OleControl
Direct Known Subclasses:
Forms2OleControl

public class OleControl 
extends java.lang.Object

Represents OLE ActiveX control.

Example:

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

Shape shape = (Shape) doc.getChild(NodeType.SHAPE, 0, true);
OleControl oleControl = shape.getOleFormat().getOleControl();

Assert.assertEquals(oleControl.getName(), null);

if (oleControl.isForms2OleControl()) {
    Forms2OleControl checkBox = (Forms2OleControl) oleControl;
    Assert.assertEquals(checkBox.getCaption(), "Первый");
    Assert.assertEquals(checkBox.getValue(), "0");
    Assert.assertEquals(checkBox.getEnabled(), true);
    Assert.assertEquals(checkBox.getType(), Forms2OleControlType.CHECK_BOX);
    Assert.assertEquals(checkBox.getChildNodes(), null);
}

Property Getters/Setters Summary
booleanisForms2OleControl()
           Returns true if the control is a Forms2OleControl.
java.lang.StringgetName()
           Gets name of the ActiveX control.
 

Property Getters/Setters Detail

isForms2OleControl

public boolean isForms2OleControl()
Returns true if the control is a Forms2OleControl.

Example:

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

Shape shape = (Shape) doc.getChild(NodeType.SHAPE, 0, true);
OleControl oleControl = shape.getOleFormat().getOleControl();

Assert.assertEquals(oleControl.getName(), null);

if (oleControl.isForms2OleControl()) {
    Forms2OleControl checkBox = (Forms2OleControl) oleControl;
    Assert.assertEquals(checkBox.getCaption(), "Первый");
    Assert.assertEquals(checkBox.getValue(), "0");
    Assert.assertEquals(checkBox.getEnabled(), true);
    Assert.assertEquals(checkBox.getType(), Forms2OleControlType.CHECK_BOX);
    Assert.assertEquals(checkBox.getChildNodes(), null);
}

getName

public java.lang.String getName()
Gets name of the ActiveX control.

Example:

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

Shape shape = (Shape) doc.getChild(NodeType.SHAPE, 0, true);
OleControl oleControl = shape.getOleFormat().getOleControl();

Assert.assertEquals(oleControl.getName(), null);

if (oleControl.isForms2OleControl()) {
    Forms2OleControl checkBox = (Forms2OleControl) oleControl;
    Assert.assertEquals(checkBox.getCaption(), "Первый");
    Assert.assertEquals(checkBox.getValue(), "0");
    Assert.assertEquals(checkBox.getEnabled(), true);
    Assert.assertEquals(checkBox.getType(), Forms2OleControlType.CHECK_BOX);
    Assert.assertEquals(checkBox.getChildNodes(), null);
}

See Also:
          Aspose.Words Documentation - the home page for the Aspose.Words Product Documentation.
          Aspose.Words Support Forum - our preferred method of support.