OleControl

Inheritance: java.lang.Object

public class OleControl

Represents OLE ActiveX control.

To learn more, visit the Working with Ole Objects documentation article.

Examples:

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(), "CheckBox1");

 if (oleControl.isForms2OleControl()) {
     Forms2OleControl checkBox = (Forms2OleControl) oleControl;
     Assert.assertEquals(checkBox.getCaption(), "First");
     Assert.assertEquals(checkBox.getValue(), "0");
     Assert.assertEquals(checkBox.getEnabled(), true);
     Assert.assertEquals(checkBox.getType(), Forms2OleControlType.CHECK_BOX);
     Assert.assertEquals(checkBox.getChildNodes(), null);
 }
 

Methods

MethodDescription
getClsidInternal()
getExtensionForUser(String progId)
getFileNameForUser()
getId()
getName()Gets name of the ActiveX control.
isForms2OleControl()Returns true if the control is a Forms2OleControl.
isForms2OleControlInternal()
setId(int value)
setName(String value)Sets name of the ActiveX control.

getClsidInternal()

public String getClsidInternal()

Returns: java.lang.String

getExtensionForUser(String progId)

public String getExtensionForUser(String progId)

Parameters:

ParameterTypeDescription
progIdjava.lang.String

Returns: java.lang.String

getFileNameForUser()

public String getFileNameForUser()

Returns: java.lang.String

getId()

public int getId()

Returns: int

getName()

public String getName()

Gets name of the ActiveX control.

Examples:

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(), "CheckBox1");

 if (oleControl.isForms2OleControl()) {
     Forms2OleControl checkBox = (Forms2OleControl) oleControl;
     Assert.assertEquals(checkBox.getCaption(), "First");
     Assert.assertEquals(checkBox.getValue(), "0");
     Assert.assertEquals(checkBox.getEnabled(), true);
     Assert.assertEquals(checkBox.getType(), Forms2OleControlType.CHECK_BOX);
     Assert.assertEquals(checkBox.getChildNodes(), null);
 }
 

Returns: java.lang.String - Name of the ActiveX control.

isForms2OleControl()

public boolean isForms2OleControl()

Returns true if the control is a Forms2OleControl.

Examples:

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(), "CheckBox1");

 if (oleControl.isForms2OleControl()) {
     Forms2OleControl checkBox = (Forms2OleControl) oleControl;
     Assert.assertEquals(checkBox.getCaption(), "First");
     Assert.assertEquals(checkBox.getValue(), "0");
     Assert.assertEquals(checkBox.getEnabled(), true);
     Assert.assertEquals(checkBox.getType(), Forms2OleControlType.CHECK_BOX);
     Assert.assertEquals(checkBox.getChildNodes(), null);
 }
 

Returns: boolean - true if the control is a Forms2OleControl.

isForms2OleControlInternal()

public boolean isForms2OleControlInternal()

Returns: boolean

setId(int value)

public void setId(int value)

Parameters:

ParameterTypeDescription
valueint

setName(String value)

public void setName(String value)

Sets name of the ActiveX control.

Examples:

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(), "CheckBox1");

 if (oleControl.isForms2OleControl()) {
     Forms2OleControl checkBox = (Forms2OleControl) oleControl;
     Assert.assertEquals(checkBox.getCaption(), "First");
     Assert.assertEquals(checkBox.getValue(), "0");
     Assert.assertEquals(checkBox.getEnabled(), true);
     Assert.assertEquals(checkBox.getType(), Forms2OleControlType.CHECK_BOX);
     Assert.assertEquals(checkBox.getChildNodes(), null);
 }
 

Parameters:

ParameterTypeDescription
valuejava.lang.StringName of the ActiveX control.