1. 搜索路径:%AppData%\kingsoft\wps\,如果该路径下没有jsaddons文件夹,则新建jsaddons文件夹,该文件夹为js插件的安装路径 2. 在jsaddons文件夹新建publish.xml,type=“epp”、type=“et”、type=“wps”控制加载项在ppt、excel、wps加载

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<jsplugins>
  <jsplugin name="epp" type="epp" url="file://" debug="" enable="enable_dev"  install="null"/>
  <jsplugin name="et" type="et" url="file://" debug="" enable="enable_dev"  install="null"/>
  <jsplugin name="wps" type="wps" url="file://" debug="" enable="enable_dev"  install="null"/>
</jsplugins>

3. 新建项目文件夹: epp_、et_、wps_,其中项目名_为固定写法

4. 在epp_、et_、wps_ 文件夹中新建ribbon.xml、index.html

<customUI>
	<ribbon startFromScratch="false">
		<tabs>
			<tab id="tab1" label = "测试WPS-JS加载项">
				<group>
					<button id="bt1" onAction="doAction" label="测试按钮" imageMso="ExportExcel"/>
				</group>
			</tab>
		</tabs>
	</ribbon>
</customUI>
<!DOCTYPE html>
<html>
<meta charset='utf-8'>
<script type='text/javascript' src='js/main.js'></script>
<script>
    function doAction(){
        alert("Hello World");
    }//这段放进main.js中
</script>
</html>

打开wps,会提示加载加载项。

这个时候点击按钮就会弹出“HelloWorld”了。