public class OleControl
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);
}
| Property Getters/Setters Summary | ||
|---|---|---|
boolean | isForms2OleControl() | |
Returns true if the control is a |
||
java.lang.String | getName() | |
Gets name of the ActiveX control.
|
||
public boolean isForms2OleControl()
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 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);
}