|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
以Word2007为例子:
1、首先,新建一个Word2007文档,并保存为"Word2007物理画板.dotm"。
2、关闭此文档,并将此文件名改为Word2007物理画板.zip(新的Office文件格式均符合OpenXML的工业标
准,其实就是一个zip包)
3、打开此zip包,创建一个新的文件夹叫CustomUI
4、在CustomUI文件夹里添加一个xml文件:LitwareRibbon.xml,这个文件用来说明新添加的选项卡的属
性以及包括哪些控件。
此文件内容为:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui">
<ribbon>
<tabs>
<tab id="LitwareTab" label="物理画板" visible="1">
<group id="AGroup" label="图象" visible="1">
<menu id="menuA1" label="曲线" itemSize="large" >
<button id="bA11" label="坐标" imageMso="HappyFace" onAction="onbtnA11"/>
<button id="bA12" label="艺术字" imageMso="HappyFace" onAction="onbtnA12"/>
<button id="bA13" label="反比线" imageMso="HappyFace" onAction="onbtnA13"/>
<button id="bA14" label="抛物线" imageMso="HappyFace" onAction="onbtnA14"/>
<button id="bA15" label="1/4圆弧" imageMso="HappyFace" onAction="onbtnA15"/>
<button id="bA16" label="圆弧" imageMso="HappyFace" onAction="onbtnA16"/>
<button id="bA17" label="正弦线" imageMso="HappyFace" onAction="onbtnA17"/>
<button id="bA18" label="方格" imageMso="HappyFace" onAction="onbtnA18"/>
<button id="bA19" label="力分解" imageMso="HappyFace" onAction="onbtnA19"/>
<button id="bA1A" label="距离标" imageMso="HappyFace" onAction="onbtnA1A"/>
</menu>
<menu id="menuA2" label="题型" itemSize="large" >
<button id="bA21" label="选择题" onAction="onbtnA21"/>
<button id="bA22" label="填空线" onAction="onbtnA22"/>
</menu>
<menu id="menuA3" label="图线" itemSize="large" >
<button id="bA31" label="位移图线" imageMso="HappyFace" onAction="onbtnA31"/>
<button id="bA32" label="速度图线" imageMso="HappyFace" onAction="onbtnA32"/>
<button id="bA33" label="简谐波" imageMso="HappyFace" onAction="onbtnA33"/>
<button id="bA34" label="受迫振动" imageMso="HappyFace" onAction="onbtnA34"/>
<button id="bA35" label="阻尼振动" imageMso="HappyFace" onAction="onbtnA35"/>
<button id="bA36" label="U-I" imageMso="HappyFace" onAction="onbtnA36"/>
<button id="bA37" label="U-R" imageMso="HappyFace" onAction="onbtnA37"/>
<button id="bA38" label="P-R" imageMso="HappyFace" onAction="onbtnA38"/>
<button id="bA39" label="η-R" imageMso="HappyFace" onAction="onbtnA39"/>
<button id="bA3A" label="晶体凝固" imageMso="HappyFace" onAction="onbtnA3A"/>
<button id="bA3B" label="晶体熔化" imageMso="HappyFace" onAction="onbtnA3B"/>
<button id="bA3C" label="非晶体凝固" imageMso="HappyFace" onAction="onbtnA3C"/>
<button id="bA3D" label="非晶体熔化" imageMso="HappyFace" onAction="onbtnA3D"/>
</menu>
<separator id="as1" />
<menu id="menuA4" label="场线" itemSize="large" >
<button id="bA41" label="正电荷" imageMso="HappyFace" onAction="onbtnA41"/>
<button id="bA42" label="负电荷" imageMso="HappyFace" onAction="onbtnA42"/>
<button id="bA43" label="等量正" imageMso="HappyFace" onAction="onbtnA43"/>
<button id="bA44" label="等量负" imageMso="HappyFace" onAction="onbtnA44"/>
<button id="bA45" label="等量异" imageMso="HappyFace" onAction="onbtnA45"/>
<button id="bA46" label="正点平板" imageMso="HappyFace" onAction="onbtnA46"/>
<button id="bA47" label="负点平板" imageMso="HappyFace" onAction="onbtnA47"/>
<button id="bA48" label="水平右" imageMso="HappyFace" onAction="onbtnA48"/>
<button id="bA49" label="向里" imageMso="HappyFace" onAction="onbtnA49"/>
<button id="bA4A" label="向外" imageMso="HappyFace" onAction="onbtnA4A"/>
</menu>
</group>
<group id="BGroup" label="刻度">
<menu id="menuB1" label="尺" itemSize="large" >
<button id="bB11" label="刻度线" imageMso="HappyFace" onAction="onbtnB11"/>
<button id="bB12" label="长刻度" imageMso="HappyFace" onAction="onbtnB12"/>
<button id="bB13" label="千分尺" imageMso="HappyFace" onAction="onbtnB13"/>
<button id="bB14" label="游标10" imageMso="HappyFace" onAction="onbtnB14"/>
<button id="bB15" label="游标20" imageMso="HappyFace" onAction="onbtnB15"/>
<button id="bB16" label="游标50" imageMso="HappyFace" onAction="onbtnB16"/>
</menu>
<menu id="menuB2" label="电表" itemSize="large" >
<button id="bB21" label="电表盘" imageMso="HappyFace" onAction="onbtnB21"/>
<button id="bB22" label="A表盘" imageMso="HappyFace" onAction="onbtnB22"/>
<button id="bB23" label="V表盘" imageMso="HappyFace" onAction="onbtnB23"/>
<button id="bB24" label="电阻箱" imageMso="HappyFace" onAction="onbtnB24"/>
</menu>
<menu id="menuB3" label="计时" itemSize="large" >
<button id="bB31" label="秒表" imageMso="HappyFace" onAction="onbtnB31"/>
<button id="bB32" label="纸带1" imageMso="HappyFace" onAction="onbtnB32"/>
<button id="bB33" label="纸带2" imageMso="HappyFace" onAction="onbtnB33"/>
</menu>
</group>
</tab>
</tabs>
</ribbon>
</customUI>
注意一定要另保存为"UTF-8"的格式.
可以看出来,这个XML定义了一个叫"物理画板"的选项卡,其中有各种按钮,点击时会触发对应的一个函
数。
5、在[Content_Types].xml文件中的</Types>前添加一个element:
<Override PartName="/CustomUI/LitwareRibbon.xml" ContentType="application/xml"/>
6、在_rels文件夹下的.rels中的</RelationShips>前添加一个element:
<Relationship Id="rId8"
Type="http://schemas.microsoft.com/office/2006/relationships/ui/extensibility"
Target="CustomUI/LitwareRibbon.xml"/>
7、讲此zip包文件名改为"Word2007物理画板.dotm",注意只要将后缀名".zip"改为".dotm"就可以了.
8、打开这个word文档,就可以在功能区中看到新添加的"物理画板"这个选项卡了.
说明:由于本人是一位物理教师,所以就以物理画板为例.函数的调用可以参考VBA资料或互相交流.电子邮箱:jxliudehua@163.com |
|