first commit
This commit is contained in:
1 parent
5b00bd10d0
commit
d15e8185bb
14 files changed
+200
-368
No files matched your search
@@ -0,0 +1,18 @@
|
|||||||
|
# XBot 文字插件
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## 配置相关
|
||||||
|
|
||||||
|
%appdata%\kingsoft\wps\jsaddons
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## 发版相关
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## 资料相关
|
||||||
|
|
||||||
|
- https://open.wps.cn/previous/docs/client/wpsload
|
||||||
|
- https://gitee.com/wpsoa/wpsoa
|
||||||
@@ -1,69 +0,0 @@
|
|||||||
function onbuttonclick(idStr)
|
|
||||||
{
|
|
||||||
switch(idStr)
|
|
||||||
{
|
|
||||||
case "getDocName":{
|
|
||||||
let doc = window.Application.ActiveDocument
|
|
||||||
let textValue = ""
|
|
||||||
if (!doc){
|
|
||||||
textValue = textValue + "当前没有打开任何文档"
|
|
||||||
return
|
|
||||||
}
|
|
||||||
textValue = textValue + doc.Name
|
|
||||||
document.getElementById("text_p").innerHTML = textValue
|
|
||||||
break
|
|
||||||
}
|
|
||||||
case "createTaskPane":{
|
|
||||||
let tsId = window.Application.PluginStorage.getItem("taskpane_id")
|
|
||||||
if (!tsId){
|
|
||||||
let tskpane = window.Application.CreateTaskPane(GetUrlPath() + "/taskpane.html")
|
|
||||||
let id = tskpane.ID
|
|
||||||
window.Application.PluginStorage.setItem("taskpane_id", id)
|
|
||||||
tskpane.Visible = true
|
|
||||||
}else{
|
|
||||||
let tskpane = window.Application.GetTaskPane(tsId)
|
|
||||||
tskpane.Visible = true
|
|
||||||
}
|
|
||||||
break
|
|
||||||
}
|
|
||||||
case "newDoc":{
|
|
||||||
window.Application.Documents.Add()
|
|
||||||
break
|
|
||||||
}
|
|
||||||
case "addString":{
|
|
||||||
let doc = window.Application.ActiveDocument
|
|
||||||
if (doc){
|
|
||||||
doc.Range(0, 0).Text="Hello, wps加载项!"
|
|
||||||
//好像是wps的bug, 这两句话触发wps重绘
|
|
||||||
let rgSel = window.Application.Selection.Range
|
|
||||||
if (rgSel)
|
|
||||||
rgSel.Select()
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case "closeDoc":{
|
|
||||||
if (window.Application.Documents.Count < 2)
|
|
||||||
{
|
|
||||||
alert("当前只有一个文档,别关了。")
|
|
||||||
break
|
|
||||||
}
|
|
||||||
|
|
||||||
let doc = window.Application.ActiveDocument
|
|
||||||
if (doc)
|
|
||||||
doc.Close()
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
window.onload = function () {
|
|
||||||
var xmlReq = WpsInvoke.CreateXHR();
|
|
||||||
var url = location.origin + "/.debugTemp/NotifyDemoUrl"
|
|
||||||
xmlReq.open("GET", url);
|
|
||||||
xmlReq.onload = function (res) {
|
|
||||||
var node = document.getElementById("DemoSpan");
|
|
||||||
node.innerText = res.target.responseText;
|
|
||||||
};
|
|
||||||
xmlReq.send();
|
|
||||||
}
|
|
||||||
+12
-84
@@ -1,8 +1,8 @@
|
|||||||
|
|
||||||
//这个函数在整个wps加载项中是第一个执行的
|
//这个函数在整个wps加载项中是第一个执行的
|
||||||
function OnAddinLoad(ribbonUI){
|
function OnAddinLoad(ribbonUI) {
|
||||||
if (typeof (window.Application.ribbonUI) != "object"){
|
if (typeof (window.Application.ribbonUI) != "object") {
|
||||||
window.Application.ribbonUI = ribbonUI
|
window.Application.ribbonUI = ribbonUI
|
||||||
}
|
}
|
||||||
|
|
||||||
if (typeof (window.Application.Enum) != "object") { // 如果没有内置枚举值
|
if (typeof (window.Application.Enum) != "object") { // 如果没有内置枚举值
|
||||||
@@ -15,6 +15,7 @@ function OnAddinLoad(ribbonUI){
|
|||||||
}
|
}
|
||||||
|
|
||||||
var WebNotifycount = 0;
|
var WebNotifycount = 0;
|
||||||
|
|
||||||
function OnAction(control) {
|
function OnAction(control) {
|
||||||
const eleId = control.Id
|
const eleId = control.Id
|
||||||
switch (eleId) {
|
switch (eleId) {
|
||||||
@@ -28,57 +29,6 @@ function OnAction(control) {
|
|||||||
alert(doc.Name)
|
alert(doc.Name)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case "btnIsEnbable":
|
|
||||||
{
|
|
||||||
let bFlag = window.Application.PluginStorage.getItem("EnableFlag")
|
|
||||||
window.Application.PluginStorage.setItem("EnableFlag", !bFlag)
|
|
||||||
|
|
||||||
//通知wps刷新以下几个按饰的状态
|
|
||||||
window.Application.ribbonUI.InvalidateControl("btnIsEnbable")
|
|
||||||
window.Application.ribbonUI.InvalidateControl("btnShowDialog")
|
|
||||||
window.Application.ribbonUI.InvalidateControl("btnShowTaskPane")
|
|
||||||
//window.Application.ribbonUI.Invalidate(); 这行代码打开则是刷新所有的按钮状态
|
|
||||||
break
|
|
||||||
}
|
|
||||||
case "btnShowDialog":
|
|
||||||
window.Application.ShowDialog(GetUrlPath() + "/ui/dialog.html", "这是一个对话框网页", 400 * window.devicePixelRatio, 400 * window.devicePixelRatio, false)
|
|
||||||
break
|
|
||||||
case "btnShowTaskPane":
|
|
||||||
{
|
|
||||||
let tsId = window.Application.PluginStorage.getItem("taskpane_id")
|
|
||||||
if (!tsId) {
|
|
||||||
let tskpane = window.Application.CreateTaskPane(GetUrlPath() + "/ui/taskpane.html")
|
|
||||||
let id = tskpane.ID
|
|
||||||
window.Application.PluginStorage.setItem("taskpane_id", id)
|
|
||||||
tskpane.Visible = true
|
|
||||||
} else {
|
|
||||||
let tskpane = window.Application.GetTaskPane(tsId)
|
|
||||||
tskpane.Visible = !tskpane.Visible
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break
|
|
||||||
case "btnApiEvent":
|
|
||||||
{
|
|
||||||
let bFlag = window.Application.PluginStorage.getItem("ApiEventFlag")
|
|
||||||
let bRegister = bFlag ? false : true
|
|
||||||
window.Application.PluginStorage.setItem("ApiEventFlag", bRegister)
|
|
||||||
if (bRegister){
|
|
||||||
window.Application.ApiEvent.AddApiEventListener('DocumentNew', OnNewDocumentApiEvent)
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
window.Application.ApiEvent.RemoveApiEventListener('DocumentNew', OnNewDocumentApiEvent)
|
|
||||||
}
|
|
||||||
|
|
||||||
window.Application.ribbonUI.InvalidateControl("btnApiEvent")
|
|
||||||
}
|
|
||||||
break
|
|
||||||
case "btnWebNotify":
|
|
||||||
{
|
|
||||||
let currentTime = new Date()
|
|
||||||
let timeStr = currentTime.getHours() + ':' + currentTime.getMinutes() + ":" + currentTime.getSeconds()
|
|
||||||
window.Application.OAAssist.WebNotify("这行内容由wps加载项主动送达给业务系统,可以任意自定义, 比如时间值:" + timeStr + ",次数:" + (++WebNotifycount), true)
|
|
||||||
}
|
|
||||||
break
|
|
||||||
default:
|
default:
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
@@ -90,10 +40,6 @@ function GetImage(control) {
|
|||||||
switch (eleId) {
|
switch (eleId) {
|
||||||
case "btnShowMsg":
|
case "btnShowMsg":
|
||||||
return "images/1.svg"
|
return "images/1.svg"
|
||||||
case "btnShowDialog":
|
|
||||||
return "images/2.svg"
|
|
||||||
case "btnShowTaskPane":
|
|
||||||
return "images/3.svg"
|
|
||||||
default:
|
default:
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
@@ -106,47 +52,29 @@ function OnGetEnabled(control) {
|
|||||||
case "btnShowMsg":
|
case "btnShowMsg":
|
||||||
return true
|
return true
|
||||||
break
|
break
|
||||||
case "btnShowDialog":
|
|
||||||
{
|
|
||||||
let bFlag = window.Application.PluginStorage.getItem("EnableFlag")
|
|
||||||
return bFlag
|
|
||||||
break
|
|
||||||
}
|
|
||||||
case "btnShowTaskPane":
|
|
||||||
{
|
|
||||||
let bFlag = window.Application.PluginStorage.getItem("EnableFlag")
|
|
||||||
return bFlag
|
|
||||||
break
|
|
||||||
}
|
|
||||||
default:
|
default:
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
function OnGetVisible(control){
|
function OnGetVisible(control) {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
function OnGetLabel(control){
|
function OnGetLabel(control) {
|
||||||
const eleId = control.Id
|
const eleId = control.Id
|
||||||
switch (eleId) {
|
switch (eleId) {
|
||||||
case "btnIsEnbable":
|
case "btnIsEnbable":
|
||||||
{
|
{
|
||||||
let bFlag = window.Application.PluginStorage.getItem("EnableFlag")
|
let bFlag = window.Application.PluginStorage.getItem("EnableFlag")
|
||||||
return bFlag ? "按钮Disable" : "按钮Enable"
|
return bFlag ? "按钮Disable" : "按钮Enable"
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
case "btnApiEvent":
|
|
||||||
{
|
|
||||||
let bFlag = window.Application.PluginStorage.getItem("ApiEventFlag")
|
|
||||||
return bFlag ? "清除新建文件事件" : "注册新建文件事件"
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
function OnNewDocumentApiEvent(doc){
|
function OnNewDocumentApiEvent(doc) {
|
||||||
alert("新建文件事件响应,取文件名: " + doc.Name)
|
alert("新建文件事件响应,取文件名: " + doc.Name)
|
||||||
}
|
}
|
||||||
@@ -1,37 +0,0 @@
|
|||||||
|
|
||||||
function openOfficeFileFromSystemDemo(param){
|
|
||||||
let jsonObj = (typeof(param)=='string' ? JSON.parse(param) : param)
|
|
||||||
alert("从业务系统传过来的参数为:" + JSON.stringify(jsonObj))
|
|
||||||
return {wps加载项项返回: jsonObj.filepath + ", 这个地址给的不正确"}
|
|
||||||
}
|
|
||||||
|
|
||||||
function InvokeFromSystemDemo(param){
|
|
||||||
let jsonObj = (typeof(param)=='string' ? JSON.parse(param) : param)
|
|
||||||
let handleInfo = jsonObj.Index
|
|
||||||
switch (handleInfo){
|
|
||||||
case "getDocumentName":{
|
|
||||||
let docName = ""
|
|
||||||
if (window.Application.ActiveDocument){
|
|
||||||
docName = window.Application.ActiveDocument.Name
|
|
||||||
}
|
|
||||||
|
|
||||||
return {当前打开的文件名为:docName}
|
|
||||||
}
|
|
||||||
|
|
||||||
case "newDocument":{
|
|
||||||
let newDocName=""
|
|
||||||
let doc = window.Application.Documents.Add()
|
|
||||||
newDocName = doc.Name
|
|
||||||
|
|
||||||
return {操作结果:"新建文档成功,文档名为:" + newDocName}
|
|
||||||
}
|
|
||||||
|
|
||||||
case "OpenFile":{
|
|
||||||
let filePath = jsonObj.filepath
|
|
||||||
window.Application.Documents.OpenFromUrl(filePath)
|
|
||||||
return {操作结果:"打开文件成功"}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return {其它xxx:""}
|
|
||||||
}
|
|
||||||
@@ -1,66 +0,0 @@
|
|||||||
function onbuttonclick(idStr)
|
|
||||||
{
|
|
||||||
if (typeof (window.Application.Enum) != "object") { // 如果没有内置枚举值
|
|
||||||
window.Application.Enum = WPS_Enum
|
|
||||||
}
|
|
||||||
switch(idStr)
|
|
||||||
{
|
|
||||||
case "dockLeft":{
|
|
||||||
let tsId = window.Application.PluginStorage.getItem("taskpane_id")
|
|
||||||
if (tsId){
|
|
||||||
let tskpane = window.Application.GetTaskPane(tsId)
|
|
||||||
tskpane.DockPosition = window.Application.Enum.msoCTPDockPositionLeft
|
|
||||||
}
|
|
||||||
break
|
|
||||||
}
|
|
||||||
case "dockRight":{
|
|
||||||
let tsId = window.Application.PluginStorage.getItem("taskpane_id")
|
|
||||||
if (tsId){
|
|
||||||
let tskpane = window.Application.GetTaskPane(tsId)
|
|
||||||
tskpane.DockPosition = window.Application.Enum.msoCTPDockPositionRight
|
|
||||||
}
|
|
||||||
break
|
|
||||||
}
|
|
||||||
case "hideTaskPane":{
|
|
||||||
let tsId = window.Application.PluginStorage.getItem("taskpane_id")
|
|
||||||
if (tsId){
|
|
||||||
let tskpane = window.Application.GetTaskPane(tsId)
|
|
||||||
tskpane.Visible = false
|
|
||||||
}
|
|
||||||
break
|
|
||||||
}
|
|
||||||
case "addString":{
|
|
||||||
let doc = window.Application.ActiveDocument
|
|
||||||
if (doc){
|
|
||||||
doc.Range(0, 0).Text="Hello, wps加载项!"
|
|
||||||
//好像是wps的bug, 这两句话触发wps重绘
|
|
||||||
let rgSel = window.Application.Selection.Range
|
|
||||||
if (rgSel)
|
|
||||||
rgSel.Select()
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case "getDocName":{
|
|
||||||
let doc = window.Application.ActiveDocument
|
|
||||||
let textValue = "";
|
|
||||||
if (!doc){
|
|
||||||
textValue = textValue + "当前没有打开任何文档"
|
|
||||||
return
|
|
||||||
}
|
|
||||||
textValue = textValue + doc.Name
|
|
||||||
document.getElementById("text_p").innerHTML = textValue
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
window.onload = function () {
|
|
||||||
var xmlReq = WpsInvoke.CreateXHR();
|
|
||||||
var url = location.origin + "/.debugTemp/NotifyDemoUrl"
|
|
||||||
xmlReq.open("GET", url);
|
|
||||||
xmlReq.onload = function (res) {
|
|
||||||
var node = document.getElementById("DemoSpan");
|
|
||||||
node.innerText = res.target.responseText;
|
|
||||||
};
|
|
||||||
xmlReq.send();
|
|
||||||
}
|
|
||||||
+36
@@ -0,0 +1,36 @@
|
|||||||
|
|
||||||
|
|
||||||
|
function InvokeFromXbot(param) {
|
||||||
|
let jsonObj = (typeof (param) == 'string' ? JSON.parse(param) : param)
|
||||||
|
let func = jsonObj.Func;
|
||||||
|
let args = jsonObj.Args;
|
||||||
|
args = JSON.parse(args);
|
||||||
|
console.log(func);
|
||||||
|
console.log(args);
|
||||||
|
switch (func) {
|
||||||
|
case "getDocumentName": {
|
||||||
|
const doc = wps.WpsApplication().ActiveDocument;
|
||||||
|
alert(doc.Name);
|
||||||
|
if (!doc) {
|
||||||
|
return { currentDoc: null }
|
||||||
|
}
|
||||||
|
return { currentDoc: doc.Name }
|
||||||
|
}
|
||||||
|
|
||||||
|
case "evalCode": {
|
||||||
|
// 1. 注入 WPS 对象
|
||||||
|
// 2. 执行函数, 获取返回值
|
||||||
|
let code = args?.code;
|
||||||
|
console.log("start eval code");
|
||||||
|
console.log(code);
|
||||||
|
// var result = eval(code);
|
||||||
|
// const tmpCode = `return ${code}`; // 为了获取返回值,需要在代码前面加上 return
|
||||||
|
const result = new Function(code)(); // 执行并获取返回值
|
||||||
|
console.log(result);
|
||||||
|
console.log("success eval code");
|
||||||
|
return { message: "ok", data: result }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return { message: "ok" }
|
||||||
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
//这个文件由index.html包含
|
//这个文件由index.html包含
|
||||||
document.write("<script language='javascript' src='js/util.js'></script>");
|
document.write("<script language='javascript' src='js/util.js'></script>");
|
||||||
document.write("<script language='javascript' src='js/ribbon.js'></script>");
|
document.write("<script language='javascript' src='js/ribbon.js'></script>");
|
||||||
document.write("<script language='javascript' src='js/systemdemo.js'></script>");
|
document.write("<script language='javascript' src='js/xbot.js'></script>");
|
||||||
+1
-1
@@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"name": "XbotWps",
|
"name": "xbotwps",
|
||||||
"addonType": "wps",
|
"addonType": "wps",
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"description": "wps加载项示例, 执行npm install后,提供代码联想功能",
|
"description": "wps加载项示例, 执行npm install后,提供代码联想功能",
|
||||||
|
|||||||
@@ -0,0 +1,18 @@
|
|||||||
|
# XbotWPS
|
||||||
|
|
||||||
|
## 介绍
|
||||||
|
|
||||||
|
|
||||||
|
## 功能
|
||||||
|
|
||||||
|
```
|
||||||
|
启动Word
|
||||||
|
Word导出PDF
|
||||||
|
读取Word文本
|
||||||
|
写入文本至Word中
|
||||||
|
定位Word光标
|
||||||
|
移动Word光标
|
||||||
|
替换Word文本
|
||||||
|
读取Word表格
|
||||||
|
插入Word表格, 插入图片, 插入超链接, 保存Word, 关闭Word
|
||||||
|
```
|
||||||
@@ -0,0 +1,83 @@
|
|||||||
|
import base64
|
||||||
|
import uuid
|
||||||
|
import json
|
||||||
|
import http.client
|
||||||
|
import webbrowser
|
||||||
|
|
||||||
|
|
||||||
|
def start_http_server():
|
||||||
|
"""start debug"""
|
||||||
|
webbrowser.open("ksowpscloudsvr://start=RelayHttpServer")
|
||||||
|
|
||||||
|
|
||||||
|
def get_version():
|
||||||
|
"""check http status by get version"""
|
||||||
|
try:
|
||||||
|
conn = http.client.HTTPConnection("127.0.0.1", 58890)
|
||||||
|
conn.request("POST", "/version", body="{}", headers={})
|
||||||
|
response = conn.getresponse()
|
||||||
|
data = response.read()
|
||||||
|
conn.close()
|
||||||
|
return response.status == 200
|
||||||
|
except:
|
||||||
|
return False
|
||||||
|
|
||||||
|
|
||||||
|
def invoke_wps_func(func, args):
|
||||||
|
|
||||||
|
# 可能触发是否允许访问
|
||||||
|
invoke_param = {
|
||||||
|
"Func": func,
|
||||||
|
"Args": json.dumps(args),
|
||||||
|
"AppType": "wps",
|
||||||
|
}
|
||||||
|
|
||||||
|
req_uui = str(uuid.uuid4())
|
||||||
|
|
||||||
|
info = f"{json.dumps(invoke_param)});\
|
||||||
|
var xhr = new XMLHttpRequest();\
|
||||||
|
xhr.open('POST', 'http://127.0.0.1:58890/transferEcho/runParams');\
|
||||||
|
xhr.send(JSON.stringify({{id: '{req_uui}', response: res}}));void(0"
|
||||||
|
|
||||||
|
data = {
|
||||||
|
"name": "xbotwps",
|
||||||
|
"function": "var res = InvokeFromXbot",
|
||||||
|
"info": info,
|
||||||
|
"showToFront": True,
|
||||||
|
"jsPluginsXml": "",
|
||||||
|
}
|
||||||
|
|
||||||
|
payload = {
|
||||||
|
"id": req_uui,
|
||||||
|
"app": "wps",
|
||||||
|
"data": "ksowebstartupwps://"
|
||||||
|
+ base64.b64encode(json.dumps(data).encode()).decode(),
|
||||||
|
"mode": False,
|
||||||
|
}
|
||||||
|
|
||||||
|
conn = http.client.HTTPConnection("127.0.0.1", 58890)
|
||||||
|
payload = json.dumps(payload)
|
||||||
|
|
||||||
|
conn.request("POST", "/transfer/runParams", payload)
|
||||||
|
|
||||||
|
http_response = conn.getresponse()
|
||||||
|
data = http_response.read()
|
||||||
|
conn.close()
|
||||||
|
|
||||||
|
try:
|
||||||
|
return json.loads(data.decode("utf-8"))
|
||||||
|
except Exception as e:
|
||||||
|
print(data.decode("utf-8"))
|
||||||
|
return {"message": "failed to parse response"}
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
start_http_server()
|
||||||
|
|
||||||
|
print(get_version())
|
||||||
|
|
||||||
|
func = "getDocumentName"
|
||||||
|
func = "evalCode"
|
||||||
|
args = {"code": "wps.WpsApplication().ActiveDocument.Name"}
|
||||||
|
res = invoke_wps_func(func, args)
|
||||||
|
print(res)
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
const wps = {
|
||||||
|
app: wps.WpsApplication(),
|
||||||
|
replace: () => {
|
||||||
|
Selection.SetRange(16, 16);
|
||||||
|
Selection.Find.Wrap = wdFindContinue;
|
||||||
|
(obj => {
|
||||||
|
obj.Text = "1";
|
||||||
|
obj.Forward = true;
|
||||||
|
obj.Wrap = wdFindContinue;
|
||||||
|
obj.MatchCase = false;
|
||||||
|
obj.MatchByte = true;
|
||||||
|
obj.MatchWildcards = false;
|
||||||
|
obj.MatchWholeWord = false;
|
||||||
|
obj.MatchFuzzy = false;
|
||||||
|
obj.Replacement.Text = "2";
|
||||||
|
})(Selection.Find);
|
||||||
|
(obj => {
|
||||||
|
obj.Style = "";
|
||||||
|
obj.Highlight = wdUndefined;
|
||||||
|
(obj => {
|
||||||
|
obj.Style = "";
|
||||||
|
obj.Highlight = wdUndefined;
|
||||||
|
})(obj.Replacement);
|
||||||
|
})(Selection.Find);
|
||||||
|
Selection.Find.Execute(undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, wdReplaceAll, undefined, undefined, undefined, undefined);
|
||||||
|
Selection.Find.Replacement.Text = "2";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
+2
-7
@@ -1,14 +1,9 @@
|
|||||||
<customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui" onLoad="OnAddinLoad">
|
<customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui" onLoad="OnAddinLoad">
|
||||||
<ribbon startFromScratch="false">
|
<ribbon startFromScratch="false">
|
||||||
<tabs>
|
<tabs>
|
||||||
<tab id="wpsAddinTab" label="wps加载项示例">
|
<tab id="wpsAddinTab" label="XbotWPS">
|
||||||
<group id="btnDemoGroup" label="group1">
|
<group id="btnDemoGroup" label="group1">
|
||||||
<button id="btnShowMsg" label="弹出消息框" onAction="OnAction" getEnabled="OnGetEnabled" getImage="GetImage" visible="true" size="large"/>
|
<button id="btnShowMsg" label="添加文字" onAction="OnAction" getEnabled="OnGetEnabled" getImage="GetImage" visible="true" size="large"/>
|
||||||
<button id="btnIsEnbable" getLabel="OnGetLabel" onAction="OnAction" enabled="true" getImage="GetImage" visible="true" size="large"/>
|
|
||||||
<button id="btnShowDialog" label="弹对话框网页" onAction="OnAction" getEnabled="OnGetEnabled" getImage="GetImage" getVisible="OnGetVisible" size="large"/>
|
|
||||||
<button id="btnShowTaskPane" label="弹任务窗格网页" onAction="OnAction" getEnabled="OnGetEnabled" getImage="GetImage" getVisible="OnGetVisible" size="large"/>
|
|
||||||
<button id="btnApiEvent" getLabel="OnGetLabel" onAction="OnAction" getEnabled="OnGetEnabled" getImage="GetImage" getVisible="OnGetVisible" size="large"/>
|
|
||||||
<button id="btnWebNotify" label="给业务系统发通知" onAction="OnAction" enabled="true" getImage="GetImage" getVisible="OnGetVisible" size="large"/>
|
|
||||||
</group>
|
</group>
|
||||||
</tab>
|
</tab>
|
||||||
</tabs>
|
</tabs>
|
||||||
|
|||||||
@@ -1,53 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html>
|
|
||||||
|
|
||||||
<head>
|
|
||||||
<meta charset="utf-8">
|
|
||||||
</head>
|
|
||||||
<script type="text/javascript" src="../js/util.js"></script>
|
|
||||||
<script type="text/javascript" src="../js/dialog.js"></script>
|
|
||||||
<script type="text/javascript" src="../.debugTemp/wpsjsrpcsdk.js"></script>
|
|
||||||
|
|
||||||
<body>
|
|
||||||
<div class="global">
|
|
||||||
<div class="divItem">
|
|
||||||
这是一个网页,按<span style="font-weight: bolder;">"F12"</span>可以打开调试器。
|
|
||||||
</div>
|
|
||||||
<div class="divItem">
|
|
||||||
这个示例展示了wps加载项的相关基础能力,与B/S业务系统的交互,请用浏览器打开:
|
|
||||||
<span style="font-weight: bolder;color: slateblue;cursor:pointer" id="DemoSpan"
|
|
||||||
onclick="shellExecuteByOAAssist(this.innerHTML)"></span>
|
|
||||||
</div>
|
|
||||||
<div class="divItem">开发文档: <span style="font-weight: bolder;color: slateblue;cursor:pointer"
|
|
||||||
onclick="shellExecuteByOAAssist(this.innerHTML)">https://open.wps.cn/docs/office</span></div>
|
|
||||||
<hr>
|
|
||||||
<div class="divItem">
|
|
||||||
<button style="margin:3px;" onclick="onbuttonclick('getDocName')">取文件名</button>
|
|
||||||
<button style="margin:3px;" onclick="onbuttonclick('createTaskPane')">创建任务窗格</button>
|
|
||||||
<button style="margin:3px;" onclick="onbuttonclick('newDoc')">新建文件</button>
|
|
||||||
<button style="margin:3px;" onclick="onbuttonclick('addString')">文档开头添加字符串</button>
|
|
||||||
<button style="margin:3px;" onclick="onbuttonclick('closeDoc')">关闭文件</button>
|
|
||||||
</div>
|
|
||||||
<hr>
|
|
||||||
<div class="divItem">文档文件名为:<span id="text_p"></span></div>
|
|
||||||
</div>
|
|
||||||
</body>
|
|
||||||
|
|
||||||
<style>
|
|
||||||
.global {
|
|
||||||
font-size: 15px;
|
|
||||||
min-height: 95%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.divItem {
|
|
||||||
margin-left: 5px;
|
|
||||||
margin-bottom: 18px;
|
|
||||||
font-size: 15px;
|
|
||||||
word-wrap: break-word;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
<script>
|
|
||||||
|
|
||||||
</script>
|
|
||||||
|
|
||||||
</html>
|
|
||||||
@@ -1,50 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html>
|
|
||||||
|
|
||||||
<head>
|
|
||||||
<meta charset="utf-8">
|
|
||||||
</head>
|
|
||||||
<script type="text/javascript" src="../js/util.js"></script>
|
|
||||||
<script type="text/javascript" src="../js/taskpane.js"></script>
|
|
||||||
<script type="text/javascript" src="../.debugTemp/wpsjsrpcsdk.js"></script>
|
|
||||||
|
|
||||||
<body>
|
|
||||||
<div class="global">
|
|
||||||
<div class="divItem">
|
|
||||||
这是一个网页,按<span style="font-weight: bolder;">"F12"</span>可以打开调试器。
|
|
||||||
</div>
|
|
||||||
<div class="divItem">
|
|
||||||
这个示例展示了wps加载项的相关基础能力,与B/S业务系统的交互,请用浏览器打开:
|
|
||||||
<span style="font-weight: bolder;color: slateblue;cursor:pointer" id="DemoSpan"
|
|
||||||
onclick="shellExecuteByOAAssist(this.innerHTML)"></span>
|
|
||||||
</div>
|
|
||||||
<div class="divItem">开发文档: <span style="font-weight: bolder;color: slateblue;cursor:pointer"
|
|
||||||
onclick="shellExecuteByOAAssist(this.innerHTML)">https://open.wps.cn/docs/office</span></div>
|
|
||||||
<hr>
|
|
||||||
<div class="divItem">
|
|
||||||
<button style="margin:3px;" onclick="onbuttonclick('dockLeft')">停靠左边</button>
|
|
||||||
<button style="margin:3px;" onclick="onbuttonclick('dockRight')">停靠右边</button>
|
|
||||||
<button style="margin:3px;" onclick="onbuttonclick('hideTaskPane')">隐藏TaskPane</button>
|
|
||||||
<button style="margin:3px;" onclick="onbuttonclick('addString')">文档开头添加字符串</button>
|
|
||||||
<button style="margin:3px;" onclick="onbuttonclick('getDocName')">取文件名</button>
|
|
||||||
</div>
|
|
||||||
<hr>
|
|
||||||
<div class="divItem">文档文件名为:<span id="text_p"></span></div>
|
|
||||||
</div>
|
|
||||||
</body>
|
|
||||||
|
|
||||||
<style>
|
|
||||||
.global {
|
|
||||||
font-size: 15px;
|
|
||||||
min-height: 95%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.divItem {
|
|
||||||
margin-left: 5px;
|
|
||||||
margin-bottom: 18px;
|
|
||||||
font-size: 15px;
|
|
||||||
word-wrap: break-word;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|
||||||
</html>
|
|
||||||
Reference in new issue
Block a user