The post is to give some information on ActiveXControls in Office document.
An ActiveX control can be added,say in a Word document from the Controls tag,in the developer ribbon.
This can also be done from the packaging structure.
for example if a text box is to be included in the document,
in 'document.xml',include this part of xml in the location you want the control to appear,
<w:p>
<w:r>
<w:object>
<w:ocx r:id="rId12" w:id="TextBox1" w:name="TextBox1" w:shapeid="_x0000_i1032" w:class="shape" w:w="96" w:h="26" />
</w:object>
</w:r>
</w:p>
The properties of the control included in the document are described in ,
' word\activeX\activeXx.xml ',i.e. each control has a separate activeX xml file describing it.
These properties can be edited accordingly.
The contents of activeX1.xml would be,
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<ax:ocx ax:classid="{978C9E23-D4B0-11CE-BF2D-00AA003F40D0}" ax:persistence="persistPropertyBag" xmlns:ax="http://schemas.openxmlformats.org/officeDocument/2006/2/activeX" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships">
<ax:ocxPr ax:name="ForeColor" ax:value="0" />
<ax:ocxPr ax:name="BackColor" ax:value="16777215" />
<ax:ocxPr ax:name="Caption" ax:value="Name" />
<ax:ocxPr ax:name="Size" ax:value="2540;635" />
<ax:ocxPr ax:name="FontName" ax:value="Calibri" />
<ax:ocxPr ax:name="FontHeight" ax:value="225" />
<ax:ocxPr ax:name="FontCharSet" ax:value="0" />
<ax:ocxPr ax:name="FontPitchAndFamily" ax:value="2" />
</ax:ocx>
Here the attribute,'classid' would be an unique identifier,and the attribute,' persistance' specifies the method used to store properties for this ActiveX control.If 'ocxPr' tags are contained in the parent 'ocx' element, this value must be set to 'persistPropertyBag', otherwise, the 'ocx' element must specify a binary part which contains the control's properties as a binary stream.
Set the corresponding relationship in the document relationship file
<Relationship Id="rId12" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/activeXControl" Target="activeX/activeX1.xml" />
Set the content types as well.
<Override PartName="/word/activeX/activeX1.xml" ContentType="application/vnd.openxmlformats-officedocument.activeX+xml" />
Regards,
Vijayeta