public abstract class Forms2OleControl
Example:
Document doc = new Document(getMyDir() + "ActiveX controls.docx");
// Get ActiveX control from the document
Shape shape = (Shape) doc.getChild(NodeType.SHAPE, 0, true);
OleControl oleControl = shape.getOleFormat().getOleControl();
Assert.assertEquals(oleControl.getName(), null);
// Get ActiveX control properties
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 | ||
---|---|---|
java.lang.String | getCaption() | |
Gets Caption property of control. Default value is an empty string.
|
||
Forms2OleControlCollection | getChildNodes() | |
Gets collection of immediate child controls.
|
||
boolean | getEnabled() | |
Returns true if control is in enabled state.
|
||
boolean | isForms2OleControl() | |
java.lang.String | getName() | |
Gets name of the ActiveX control.
|
||
int | getType() | |
Gets type of Forms 2.0 control.
The value of the property is Forms2OleControlType integer constant. |
||
java.lang.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.
|
public java.lang.String getCaption()
Example:
Shows how to get ActiveX control and properties from the document.Document doc = new Document(getMyDir() + "ActiveX controls.docx"); // Get ActiveX control from the document Shape shape = (Shape) doc.getChild(NodeType.SHAPE, 0, true); OleControl oleControl = shape.getOleFormat().getOleControl(); Assert.assertEquals(oleControl.getName(), null); // Get ActiveX control properties 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); }
public Forms2OleControlCollection getChildNodes()
Example:
Shows how to get ActiveX control and properties from the document.Document doc = new Document(getMyDir() + "ActiveX controls.docx"); // Get ActiveX control from the document Shape shape = (Shape) doc.getChild(NodeType.SHAPE, 0, true); OleControl oleControl = shape.getOleFormat().getOleControl(); Assert.assertEquals(oleControl.getName(), null); // Get ActiveX control properties 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); }
public boolean getEnabled()
Example:
Shows how to get ActiveX control and properties from the document.Document doc = new Document(getMyDir() + "ActiveX controls.docx"); // Get ActiveX control from the document Shape shape = (Shape) doc.getChild(NodeType.SHAPE, 0, true); OleControl oleControl = shape.getOleFormat().getOleControl(); Assert.assertEquals(oleControl.getName(), null); // Get ActiveX control properties 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); }
public boolean isForms2OleControl()
public java.lang.String getName()
Example:
Shows how to get ActiveX control and properties from the document.Document doc = new Document(getMyDir() + "ActiveX controls.docx"); // Get ActiveX control from the document Shape shape = (Shape) doc.getChild(NodeType.SHAPE, 0, true); OleControl oleControl = shape.getOleFormat().getOleControl(); Assert.assertEquals(oleControl.getName(), null); // Get ActiveX control properties 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); }
public int getType()
Example:
Shows how to get ActiveX control and properties from the document.Document doc = new Document(getMyDir() + "ActiveX controls.docx"); // Get ActiveX control from the document Shape shape = (Shape) doc.getChild(NodeType.SHAPE, 0, true); OleControl oleControl = shape.getOleFormat().getOleControl(); Assert.assertEquals(oleControl.getName(), null); // Get ActiveX control properties 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); }
public java.lang.String getValue()
Example:
Shows how to get ActiveX control and properties from the document.Document doc = new Document(getMyDir() + "ActiveX controls.docx"); // Get ActiveX control from the document Shape shape = (Shape) doc.getChild(NodeType.SHAPE, 0, true); OleControl oleControl = shape.getOleFormat().getOleControl(); Assert.assertEquals(oleControl.getName(), null); // Get ActiveX control properties 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); }