CheckBoxControl
Inheritance: java.lang.Object, com.aspose.words.OleControl, com.aspose.words.Forms2OleControl, com.aspose.words.MorphDataControl
public class CheckBoxControl extends MorphDataControl
The CheckBox control toggles a value.
Remarks:
It has three possible states: selected, cleared, and neither selected nor cleared, meaning a combination of on and off states.
Examples:
Shows how to change state of the CheckBox control.
Document doc = new Document(getMyDir() + "ActiveX controls.docx");
Shape shape = (Shape)doc.getChild(NodeType.SHAPE, 0, true);
CheckBoxControl checkBoxControl = (CheckBoxControl)shape.getOleFormat().getOleControl();
checkBoxControl.setChecked(true);
Assert.assertEquals(true, checkBoxControl.getChecked());
Assert.assertEquals(Forms2OleControlType.CHECK_BOX, checkBoxControl.getType());
Methods
Method | Description |
---|---|
getBackColor() | Gets a background color of the control. |
getCaption() | Gets Caption property of control. |
getChecked() | Gets a boolean value indicating either this CheckBoxControl is checked or not. |
getChildNodes() | Gets collection of immediate child controls. |
getClsidInternal() | |
getEnabled() | Returns true if control is in enabled state. |
getExtensionForUser(String progId) | |
getFileNameForUser() | |
getForeColor() | Gets a foreground color of the control. |
getGroupName() | Gets a string that specifies a group of mutually exclusive controls. |
getHeight() | Gets a height of the control in points. |
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. |
getWidth() | Gets a width of the control in points. |
isEmpty() | |
isForms2OleControl() | Returns true if the control is a Forms2OleControl. |
isForms2OleControlInternal() | |
setBackColor(Color value) | Sets a background color of the control. |
setChecked(boolean value) | Sets a boolean value indicating either this CheckBoxControl is checked or not. |
setForeColor(Color value) | Sets a foreground color of the control. |
setGroupName(String value) | Sets a string that specifies a group of mutually exclusive controls. |
setHeight(double value) | Sets a height of the control in points. |
setId(int value) | |
setName(String value) | Sets name of the ActiveX control. |
setWidth(double value) | Sets a width of the control in points. |
getBackColor()
public Color getBackColor()
Gets a background color of the control. The default value depends on a type of the control.
Examples:
Shows how to set properties for ActiveX control.
Document doc = new Document(getMyDir() + "ActiveX controls.docx");
Shape shape = (Shape)doc.getChild(NodeType.SHAPE, 0, true);
Forms2OleControl oleControl = (Forms2OleControl)shape.getOleFormat().getOleControl();
oleControl.setForeColor(new Color((0x17), (0xE1), (0x35)));
oleControl.setBackColor(new Color((0x33), (0x97), (0xF4)));
oleControl.setHeight(100.54);
oleControl.setWidth(201.06);
Returns: java.awt.Color - A background color of the control.
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.
getChecked()
public boolean getChecked()
Gets a boolean value indicating either this CheckBoxControl is checked or not. The default value is false .
Examples:
Shows how to change state of the CheckBox control.
Document doc = new Document(getMyDir() + "ActiveX controls.docx");
Shape shape = (Shape)doc.getChild(NodeType.SHAPE, 0, true);
CheckBoxControl checkBoxControl = (CheckBoxControl)shape.getOleFormat().getOleControl();
checkBoxControl.setChecked(true);
Assert.assertEquals(true, checkBoxControl.getChecked());
Assert.assertEquals(Forms2OleControlType.CHECK_BOX, checkBoxControl.getType());
Returns: boolean - A boolean value indicating either this CheckBoxControl is checked or not.
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:
Parameter | Type | Description |
---|---|---|
progId | java.lang.String |
Returns: java.lang.String
getFileNameForUser()
public String getFileNameForUser()
Returns: java.lang.String
getForeColor()
public Color getForeColor()
Gets a foreground color of the control. The default value depends on a type of the control.
Examples:
Shows how to set properties for ActiveX control.
Document doc = new Document(getMyDir() + "ActiveX controls.docx");
Shape shape = (Shape)doc.getChild(NodeType.SHAPE, 0, true);
Forms2OleControl oleControl = (Forms2OleControl)shape.getOleFormat().getOleControl();
oleControl.setForeColor(new Color((0x17), (0xE1), (0x35)));
oleControl.setBackColor(new Color((0x33), (0x97), (0xF4)));
oleControl.setHeight(100.54);
oleControl.setWidth(201.06);
Returns: java.awt.Color - A foreground color of the control.
getGroupName()
public String getGroupName()
Gets a string that specifies a group of mutually exclusive controls. The 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 - A string that specifies a group of mutually exclusive controls.
getHeight()
public double getHeight()
Gets a height of the control in points.
Examples:
Shows how to set properties for ActiveX control.
Document doc = new Document(getMyDir() + "ActiveX controls.docx");
Shape shape = (Shape)doc.getChild(NodeType.SHAPE, 0, true);
Forms2OleControl oleControl = (Forms2OleControl)shape.getOleFormat().getOleControl();
oleControl.setForeColor(new Color((0x17), (0xE1), (0x35)));
oleControl.setBackColor(new Color((0x33), (0x97), (0xF4)));
oleControl.setHeight(100.54);
oleControl.setWidth(201.06);
Returns: double - A height of the control in points.
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 int getType()
Gets type of Forms 2.0 control.
Examples:
Shows how to change state of the CheckBox control.
Document doc = new Document(getMyDir() + "ActiveX controls.docx");
Shape shape = (Shape)doc.getChild(NodeType.SHAPE, 0, true);
CheckBoxControl checkBoxControl = (CheckBoxControl)shape.getOleFormat().getOleControl();
checkBoxControl.setChecked(true);
Assert.assertEquals(true, checkBoxControl.getChecked());
Assert.assertEquals(Forms2OleControlType.CHECK_BOX, checkBoxControl.getType());
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.
getWidth()
public double getWidth()
Gets a width of the control in points.
Examples:
Shows how to set properties for ActiveX control.
Document doc = new Document(getMyDir() + "ActiveX controls.docx");
Shape shape = (Shape)doc.getChild(NodeType.SHAPE, 0, true);
Forms2OleControl oleControl = (Forms2OleControl)shape.getOleFormat().getOleControl();
oleControl.setForeColor(new Color((0x17), (0xE1), (0x35)));
oleControl.setBackColor(new Color((0x33), (0x97), (0xF4)));
oleControl.setHeight(100.54);
oleControl.setWidth(201.06);
Returns: double - A width of the control in points.
isEmpty()
public boolean isEmpty()
Returns: boolean
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
setBackColor(Color value)
public void setBackColor(Color value)
Sets a background color of the control. The default value depends on a type of the control.
Examples:
Shows how to set properties for ActiveX control.
Document doc = new Document(getMyDir() + "ActiveX controls.docx");
Shape shape = (Shape)doc.getChild(NodeType.SHAPE, 0, true);
Forms2OleControl oleControl = (Forms2OleControl)shape.getOleFormat().getOleControl();
oleControl.setForeColor(new Color((0x17), (0xE1), (0x35)));
oleControl.setBackColor(new Color((0x33), (0x97), (0xF4)));
oleControl.setHeight(100.54);
oleControl.setWidth(201.06);
Parameters:
Parameter | Type | Description |
---|---|---|
value | java.awt.Color | A background color of the control. |
setChecked(boolean value)
public void setChecked(boolean value)
Sets a boolean value indicating either this CheckBoxControl is checked or not. The default value is false .
Examples:
Shows how to change state of the CheckBox control.
Document doc = new Document(getMyDir() + "ActiveX controls.docx");
Shape shape = (Shape)doc.getChild(NodeType.SHAPE, 0, true);
CheckBoxControl checkBoxControl = (CheckBoxControl)shape.getOleFormat().getOleControl();
checkBoxControl.setChecked(true);
Assert.assertEquals(true, checkBoxControl.getChecked());
Assert.assertEquals(Forms2OleControlType.CHECK_BOX, checkBoxControl.getType());
Parameters:
Parameter | Type | Description |
---|---|---|
value | boolean | A boolean value indicating either this CheckBoxControl is checked or not. |
setForeColor(Color value)
public void setForeColor(Color value)
Sets a foreground color of the control. The default value depends on a type of the control.
Examples:
Shows how to set properties for ActiveX control.
Document doc = new Document(getMyDir() + "ActiveX controls.docx");
Shape shape = (Shape)doc.getChild(NodeType.SHAPE, 0, true);
Forms2OleControl oleControl = (Forms2OleControl)shape.getOleFormat().getOleControl();
oleControl.setForeColor(new Color((0x17), (0xE1), (0x35)));
oleControl.setBackColor(new Color((0x33), (0x97), (0xF4)));
oleControl.setHeight(100.54);
oleControl.setWidth(201.06);
Parameters:
Parameter | Type | Description |
---|---|---|
value | java.awt.Color | A foreground color of the control. |
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.
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:
Parameter | Type | Description |
---|---|---|
value | java.lang.String | A string that specifies a group of mutually exclusive controls. |
setHeight(double value)
public void setHeight(double value)
Sets a height of the control in points.
Examples:
Shows how to set properties for ActiveX control.
Document doc = new Document(getMyDir() + "ActiveX controls.docx");
Shape shape = (Shape)doc.getChild(NodeType.SHAPE, 0, true);
Forms2OleControl oleControl = (Forms2OleControl)shape.getOleFormat().getOleControl();
oleControl.setForeColor(new Color((0x17), (0xE1), (0x35)));
oleControl.setBackColor(new Color((0x33), (0x97), (0xF4)));
oleControl.setHeight(100.54);
oleControl.setWidth(201.06);
Parameters:
Parameter | Type | Description |
---|---|---|
value | double | A height of the control in points. |
setId(int value)
public void setId(int value)
Parameters:
Parameter | Type | Description |
---|---|---|
value | int |
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:
Parameter | Type | Description |
---|---|---|
value | java.lang.String | Name of the ActiveX control. |
setWidth(double value)
public void setWidth(double value)
Sets a width of the control in points.
Examples:
Shows how to set properties for ActiveX control.
Document doc = new Document(getMyDir() + "ActiveX controls.docx");
Shape shape = (Shape)doc.getChild(NodeType.SHAPE, 0, true);
Forms2OleControl oleControl = (Forms2OleControl)shape.getOleFormat().getOleControl();
oleControl.setForeColor(new Color((0x17), (0xE1), (0x35)));
oleControl.setBackColor(new Color((0x33), (0x97), (0xF4)));
oleControl.setHeight(100.54);
oleControl.setWidth(201.06);
Parameters:
Parameter | Type | Description |
---|---|---|
value | double | A width of the control in points. |