Forms2OleControl

Inheritance: java.lang.Object, com.aspose.words.OleControl

public abstract class Forms2OleControl extends OleControl

Represents Microsoft Forms 2.0 OLE 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);
 }
 

Constructors

ConstructorDescription
Forms2OleControl()

Methods

MethodDescription
getCaption()Gets Caption property of control.
getChildNodes()Gets collection of immediate child controls.
getClsidInternal()
getEnabled()Returns true if control is in enabled state.
getExtensionForUser(String progId)
getFileNameForUser()
getGroupName()Gets a string that specifies a group of mutually exclusive controls.
getId()
getName()Gets name of the ActiveX control.
getType()Gets type of Forms 2.0 control.
getValue()Gets underlying Value property which often represents control state.
isForms2OleControl()Returns true if the control is a Forms2OleControl.
isForms2OleControlInternal()
setGroupName(String value)Sets a string that specifies a group of mutually exclusive controls.
setId(int value)
setName(String value)Sets name of the ActiveX control.

Forms2OleControl()

public Forms2OleControl()

getCaption()

public String getCaption()

Gets Caption property of control. Default value is an empty string.

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 - Caption property of control.

getChildNodes()

public Forms2OleControlCollection getChildNodes()

Gets collection of immediate child controls.

Remarks:

Returns null if this control can not have children.

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: Forms2OleControlCollection - Collection of immediate child controls.

getClsidInternal()

public String getClsidInternal()

Returns: java.lang.String

getEnabled()

public boolean getEnabled()

Returns true if control is in enabled state.

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 control is in enabled state.

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

getGroupName()

public String getGroupName()

Gets a string that specifies a group of mutually exclusive controls. The default value is an empty string.

Returns: java.lang.String - A string that specifies a group of mutually exclusive controls.

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.

getType()

public abstract int getType()

Gets type of Forms 2.0 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: int - Type of Forms 2.0 control. The returned value is one of Forms2OleControlType constants.

getValue()

public String getValue()

Gets underlying Value property which often represents control state. For example checked option button has ‘1’ value while unchecked has ‘0’. Default value is an empty string.

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 - Underlying Value property which often represents control state.

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

setGroupName(String value)

public void setGroupName(String value)

Sets a string that specifies a group of mutually exclusive controls. The default value is an empty string.

Parameters:

ParameterTypeDescription
valuejava.lang.StringA string that specifies a group of mutually exclusive controls.

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.