uudev 1.1.7 → 1.1.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/apptemplate/office/package.json +8 -8
- package/apptemplate/office/public/menifest.json +8 -8
- package/apptemplate/office/public/readme.html +11 -11
- package/apptemplate/office/src_excel/App.vue +1 -2
- package/apptemplate/office/src_excel/demo/demo.vue +125 -121
- package/apptemplate/office/src_ppt/App.vue +1 -2
- package/apptemplate/office/src_ppt/demo/demo.vue +166 -70
- package/apptemplate/office/src_word/App.vue +1 -2
- package/apptemplate/office/src_word/demo/demo.vue +158 -58
- package/dtstype/enum/mso_enum.d.ts +6451 -6451
- package/main.js +4 -4
- package/package.json +1 -1
- package/apptemplate/office/package-lock.json +0 -4002
|
@@ -24,18 +24,18 @@
|
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
26
|
"@tsconfig/node24": "^24.0.4",
|
|
27
|
-
"@types/node": "^
|
|
27
|
+
"@types/node": "^25.8.0",
|
|
28
28
|
"@vitejs/plugin-vue": "^6.0.7",
|
|
29
29
|
"@vue/eslint-config-typescript": "^14.7.0",
|
|
30
|
-
"@vue/tsconfig": "^0.9.
|
|
31
|
-
"eslint": "^10.0
|
|
30
|
+
"@vue/tsconfig": "^0.9.1",
|
|
31
|
+
"eslint": "^10.4.0",
|
|
32
32
|
"eslint-config-prettier": "^10.1.8",
|
|
33
|
-
"eslint-plugin-oxlint": "~1.
|
|
34
|
-
"eslint-plugin-vue": "~10.
|
|
35
|
-
"jiti": "^2.
|
|
33
|
+
"eslint-plugin-oxlint": "~1.65.0",
|
|
34
|
+
"eslint-plugin-vue": "~10.9.1",
|
|
35
|
+
"jiti": "^2.7.0",
|
|
36
36
|
"npm-run-all2": "^8.0.4",
|
|
37
|
-
"oxlint": "~1.
|
|
38
|
-
"prettier": "3.8.
|
|
37
|
+
"oxlint": "~1.65.0",
|
|
38
|
+
"prettier": "3.8.3",
|
|
39
39
|
"typescript": "^6.0.3",
|
|
40
40
|
"uudev": "latest",
|
|
41
41
|
"vite": "^8.0.13",
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "appName",
|
|
3
|
-
"version": "x.x.x",
|
|
4
|
-
"note": "这里填写对这个小程序的简介",
|
|
5
|
-
"icon": "app_icon.svg",
|
|
6
|
-
"entry": "index.html",
|
|
7
|
-
"readme": "readme.html"
|
|
8
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "appName",
|
|
3
|
+
"version": "x.x.x",
|
|
4
|
+
"note": "这里填写对这个小程序的简介",
|
|
5
|
+
"icon": "app_icon.svg",
|
|
6
|
+
"entry": "index.html",
|
|
7
|
+
"readme": "readme.html"
|
|
8
|
+
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
<html lang="">
|
|
2
|
-
<head>
|
|
3
|
-
<meta charset="utf-8" />
|
|
4
|
-
<title>README</title>
|
|
5
|
-
</head>
|
|
6
|
-
<body>
|
|
7
|
-
<h1>对这个小程序的介绍</h1>
|
|
8
|
-
<p>
|
|
9
|
-
这个页面用于介绍这个小程序的功能和使用方法,可以包含一些截图或者动画图片来展示小程序的界面和操作流程。你可以在这里详细说明小程序的特点、优势以及适用场景,帮助用户更好地了解和使用这个小程序。
|
|
10
|
-
</p>
|
|
11
|
-
</body>
|
|
1
|
+
<html lang="">
|
|
2
|
+
<head>
|
|
3
|
+
<meta charset="utf-8" />
|
|
4
|
+
<title>README</title>
|
|
5
|
+
</head>
|
|
6
|
+
<body>
|
|
7
|
+
<h1>对这个小程序的介绍</h1>
|
|
8
|
+
<p>
|
|
9
|
+
这个页面用于介绍这个小程序的功能和使用方法,可以包含一些截图或者动画图片来展示小程序的界面和操作流程。你可以在这里详细说明小程序的特点、优势以及适用场景,帮助用户更好地了解和使用这个小程序。
|
|
10
|
+
</p>
|
|
11
|
+
</body>
|
|
12
12
|
</html>
|
|
@@ -1,121 +1,125 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
<template>
|
|
4
|
-
<h1>欢迎使用uudev开发工具</h1>
|
|
5
|
-
<p>
|
|
6
|
-
uudev是一个基于Office的web化开发工具集,提供了从开发、调试到部署的一站式解决方案,帮助开发者更高效地构建Office的web化插件应用。
|
|
7
|
-
</p>
|
|
8
|
-
<p style="font-weight: bold;">
|
|
9
|
-
这是一个html页面,点击本页面后,按<span style="border: 2px solid;">F11</span>可以打开调试工具。
|
|
10
|
-
</p>
|
|
11
|
-
<h2>Excel示例</h2>
|
|
12
|
-
<div>
|
|
13
|
-
<a class="demoHref" @click="putCellValue">给单元格赋值</a>(代码:Application.ActiveCell.Value = 'Hello, uudev!')
|
|
14
|
-
</div>
|
|
15
|
-
<div>
|
|
16
|
-
<a class="demoHref" @click="getDocName">取文档名</a>
|
|
17
|
-
<a class="demoHref" @click="clearDocName">清除</a>
|
|
18
|
-
<span style="color: red;">{{ sheetName }}</span>(代码:Application.ActiveWorkbook.Name)
|
|
19
|
-
</div>
|
|
20
|
-
<div>
|
|
21
|
-
<a class="demoHref" @click="newWorksheet">新建工作表</a>
|
|
22
|
-
</div>
|
|
23
|
-
<div>
|
|
24
|
-
<a class="demoHref" @click="deleteWorksheet">删除当前工作表</a><span style="color: red;">{{ deleteWorkSheetErrInfo }}</span>
|
|
25
|
-
</div>
|
|
26
|
-
<h2>事件通知示例</h2>
|
|
27
|
-
<div>
|
|
28
|
-
<label class="demoHref">
|
|
29
|
-
<input type="checkbox" v-model="isSheetSelectionChangeRegister" @change="regSelectionChange" /> 注册工作表选择改变事件
|
|
30
|
-
</label>
|
|
31
|
-
<span style="color: red;">{{ SheetSelectionChangeInfo }}</span>
|
|
32
|
-
</div>
|
|
33
|
-
<div>
|
|
34
|
-
<label class="demoHref">
|
|
35
|
-
<input type="checkbox" v-model="isNewSheetEventRegister" @change="regNewSheetEvent" /> 注册新建工作表事件
|
|
36
|
-
</label>
|
|
37
|
-
<span style="color: red;">{{ NewSheetEventInfo }}</span>
|
|
38
|
-
</div>
|
|
39
|
-
<div>
|
|
40
|
-
<span>更多其他事件类型,请查看帮助文档</span>
|
|
41
|
-
</div>
|
|
42
|
-
</template>
|
|
43
|
-
|
|
44
|
-
<script setup lang="ts">
|
|
45
|
-
import { ref } from 'vue';
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
sheetName.value =
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
}
|
|
80
|
-
const
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
deleteWorkSheetErrInfo.value = '
|
|
88
|
-
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
Application.
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
<template>
|
|
4
|
+
<h1>欢迎使用uudev开发工具</h1>
|
|
5
|
+
<p>
|
|
6
|
+
uudev是一个基于Office的web化开发工具集,提供了从开发、调试到部署的一站式解决方案,帮助开发者更高效地构建Office的web化插件应用。
|
|
7
|
+
</p>
|
|
8
|
+
<p style="font-weight: bold;">
|
|
9
|
+
这是一个html页面,点击本页面后,按<span style="border: 2px solid;">F11</span>可以打开调试工具。
|
|
10
|
+
</p>
|
|
11
|
+
<h2>Excel示例</h2>
|
|
12
|
+
<div>
|
|
13
|
+
<a class="demoHref" @click="putCellValue">给单元格赋值</a>(代码:Application.ActiveCell.Value = 'Hello, uudev!')
|
|
14
|
+
</div>
|
|
15
|
+
<div>
|
|
16
|
+
<a class="demoHref" @click="getDocName">取文档名</a>
|
|
17
|
+
<a class="demoHref" @click="clearDocName">清除</a>
|
|
18
|
+
<span style="color: red;">{{ sheetName }}</span>(代码:Application.ActiveWorkbook.Name)
|
|
19
|
+
</div>
|
|
20
|
+
<div>
|
|
21
|
+
<a class="demoHref" @click="newWorksheet">新建工作表</a>
|
|
22
|
+
</div>
|
|
23
|
+
<div>
|
|
24
|
+
<a class="demoHref" @click="deleteWorksheet">删除当前工作表</a><span style="color: red;">{{ deleteWorkSheetErrInfo }}</span>
|
|
25
|
+
</div>
|
|
26
|
+
<h2>事件通知示例</h2>
|
|
27
|
+
<div>
|
|
28
|
+
<label class="demoHref">
|
|
29
|
+
<input type="checkbox" v-model="isSheetSelectionChangeRegister" @change="regSelectionChange" /> 注册工作表选择改变事件
|
|
30
|
+
</label>
|
|
31
|
+
<span style="color: red;">{{ SheetSelectionChangeInfo }}</span>
|
|
32
|
+
</div>
|
|
33
|
+
<div>
|
|
34
|
+
<label class="demoHref">
|
|
35
|
+
<input type="checkbox" v-model="isNewSheetEventRegister" @change="regNewSheetEvent" /> 注册新建工作表事件
|
|
36
|
+
</label>
|
|
37
|
+
<span style="color: red;">{{ NewSheetEventInfo }}</span>
|
|
38
|
+
</div>
|
|
39
|
+
<div>
|
|
40
|
+
<span>更多其他事件类型,请查看帮助文档</span>
|
|
41
|
+
</div>
|
|
42
|
+
</template>
|
|
43
|
+
|
|
44
|
+
<script setup lang="ts">
|
|
45
|
+
import { ref } from 'vue';
|
|
46
|
+
|
|
47
|
+
defineOptions({
|
|
48
|
+
name: 'DemoPage',
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
const sheetName = ref('');
|
|
52
|
+
const deleteWorkSheetErrInfo = ref('');
|
|
53
|
+
const isSheetSelectionChangeRegister = ref(false);
|
|
54
|
+
const SheetSelectionChangeInfo = ref('');
|
|
55
|
+
|
|
56
|
+
const isNewSheetEventRegister = ref(false);
|
|
57
|
+
const NewSheetEventInfo = ref('');
|
|
58
|
+
|
|
59
|
+
const putCellValue = () => {
|
|
60
|
+
const activeCell = Application.ActiveCell;
|
|
61
|
+
if (activeCell) {
|
|
62
|
+
activeCell.Value = 'Hello, uudev!';
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
const getDocName=() => {
|
|
67
|
+
const doc = Application.ActiveWorkbook
|
|
68
|
+
if (doc) {
|
|
69
|
+
sheetName.value = `文档名称: ${doc.Name}`;
|
|
70
|
+
const info = `文档名称: ${doc.Name}\n文档路径: ${doc.FullName}`;
|
|
71
|
+
console.log(info);
|
|
72
|
+
} else {
|
|
73
|
+
sheetName.value = '';
|
|
74
|
+
alert('没有打开的文档');
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
const clearDocName = () => {
|
|
78
|
+
sheetName.value = '';
|
|
79
|
+
}
|
|
80
|
+
const newWorksheet = () => {
|
|
81
|
+
Application.ActiveWorkbook.Worksheets.Add();
|
|
82
|
+
deleteWorkSheetErrInfo.value = '';
|
|
83
|
+
}
|
|
84
|
+
const deleteWorksheet = () => {
|
|
85
|
+
if (Application.ActiveWorkbook.Worksheets.Count > 1) {
|
|
86
|
+
Application.ActiveWorkbook.ActiveSheet.Delete();
|
|
87
|
+
deleteWorkSheetErrInfo.value = '';
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
else{
|
|
91
|
+
deleteWorkSheetErrInfo.value = '最后一个工作表不能删除';
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
const regSelectionChange = () => {
|
|
96
|
+
if (isSheetSelectionChangeRegister.value) {
|
|
97
|
+
Application.MountEvent(XlEventType.exlSheetSelectionChange, (sheet: Worksheet, target: Range) => {
|
|
98
|
+
SheetSelectionChangeInfo.value = `选中了工作表: ${sheet.Name}!${target.Address(false, false, xlA1)}`; //也可以用xlR1C1样式
|
|
99
|
+
});
|
|
100
|
+
} else {
|
|
101
|
+
Application.UnMountEvent(exlSheetSelectionChange); //UnMountEvent不带第2个参数onNewSheet,则exlSheetSelectionChange事件的所有回调都会被反注册
|
|
102
|
+
SheetSelectionChangeInfo.value = '';
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
const regNewSheetEvent = () => {
|
|
107
|
+
const onNewSheet = (workbook: Workbook, sheet: Worksheet) => {
|
|
108
|
+
NewSheetEventInfo.value = `新建了工作表:${sheet.Name}`;
|
|
109
|
+
};
|
|
110
|
+
if (isNewSheetEventRegister.value) {
|
|
111
|
+
Application.MountEvent(exlWorkbookNewSheet, onNewSheet);
|
|
112
|
+
} else {
|
|
113
|
+
Application.UnMountEvent(exlWorkbookNewSheet, onNewSheet); //UnMountEvent带有第2个参数onNewSheet,则仅反注册onNewSheet
|
|
114
|
+
NewSheetEventInfo.value = '';
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
</script>
|
|
118
|
+
<style scoped>
|
|
119
|
+
.demoHref {
|
|
120
|
+
color: #42b983;
|
|
121
|
+
cursor: pointer;
|
|
122
|
+
text-decoration: underline;
|
|
123
|
+
margin-right: 50px;
|
|
124
|
+
}
|
|
125
|
+
</style>
|
|
@@ -1,70 +1,166 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
<template>
|
|
4
|
-
<h1>欢迎使用uudev开发工具</h1>
|
|
5
|
-
<p>
|
|
6
|
-
uudev是一个基于Office的web化开发工具集,提供了从开发、调试到部署的一站式解决方案,帮助开发者更高效地构建Office的web化插件应用。
|
|
7
|
-
</p>
|
|
8
|
-
<p style="font-weight: bold;">
|
|
9
|
-
这是一个html页面,点击本页面后,按<span style="border: 2px solid;">F11</span>可以打开调试工具。
|
|
10
|
-
</p>
|
|
11
|
-
<
|
|
12
|
-
<div>
|
|
13
|
-
|
|
14
|
-
</div>
|
|
15
|
-
<div>
|
|
16
|
-
<a class="demoHref" @click="getDocInfo">取文档信息</a>
|
|
17
|
-
<a class="demoHref" @click="clearDocInfo"
|
|
18
|
-
<span>{{ docName }}</span>(代码:Application.ActivePresentation.Name)
|
|
19
|
-
</div>
|
|
20
|
-
<
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
</
|
|
25
|
-
|
|
26
|
-
<
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
.
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
<template>
|
|
4
|
+
<h1>欢迎使用uudev开发工具</h1>
|
|
5
|
+
<p>
|
|
6
|
+
uudev是一个基于Office的web化开发工具集,提供了从开发、调试到部署的一站式解决方案,帮助开发者更高效地构建Office的web化插件应用。
|
|
7
|
+
</p>
|
|
8
|
+
<p style="font-weight: bold;">
|
|
9
|
+
这是一个html页面,点击本页面后,按<span style="border: 2px solid;">F11</span>可以打开调试工具。
|
|
10
|
+
</p>
|
|
11
|
+
<h2>PPT示例</h2>
|
|
12
|
+
<div>
|
|
13
|
+
<a class="demoHref" @click="putShapeValue">给形状赋值</a>(代码:Application.ActivePresentation.Slides.Item(1).Shapes.Item(1).TextFrame.TextRange.Text = 'Hello, uudev!')
|
|
14
|
+
</div>
|
|
15
|
+
<div>
|
|
16
|
+
<a class="demoHref" @click="getDocInfo">取文档信息</a>
|
|
17
|
+
<a class="demoHref" @click="clearDocInfo">清除</a>
|
|
18
|
+
<span style="color: red;">{{ docName }}</span>(代码:Application.ActivePresentation.Name)
|
|
19
|
+
</div>
|
|
20
|
+
<div>
|
|
21
|
+
<a class="demoHref" @click="addSlide">新建幻灯片</a>
|
|
22
|
+
</div>
|
|
23
|
+
<div>
|
|
24
|
+
<a class="demoHref" @click="deleteCurrentSlide">删除当前幻灯片</a><span style="color: red;">{{ deleteSlideErrInfo }}</span>
|
|
25
|
+
</div>
|
|
26
|
+
<h2>事件通知示例</h2>
|
|
27
|
+
<div>
|
|
28
|
+
<label class="demoHref">
|
|
29
|
+
<input type="checkbox" v-model="isWindowSelectionChangeRegister" @change="regWindowSelectionChange" /> 注册选中区域改变事件
|
|
30
|
+
</label>
|
|
31
|
+
<span style="color: red;">{{ WindowSelectionChangeInfo }}</span>
|
|
32
|
+
</div>
|
|
33
|
+
<div>
|
|
34
|
+
<label class="demoHref">
|
|
35
|
+
<input type="checkbox" v-model="isNewSlideEventRegister" @change="regNewSlideEvent" /> 注册新建幻灯片事件
|
|
36
|
+
</label>
|
|
37
|
+
<span style="color: red;">{{ NewSlideEventInfo }}</span>
|
|
38
|
+
</div>
|
|
39
|
+
<div>
|
|
40
|
+
<span>更多其他事件类型(eppPresentationOpen、eppWindowActivate等),请查看帮助文档</span>
|
|
41
|
+
</div>
|
|
42
|
+
</template>
|
|
43
|
+
|
|
44
|
+
<script setup lang="ts">
|
|
45
|
+
import { ref } from 'vue';
|
|
46
|
+
|
|
47
|
+
defineOptions({
|
|
48
|
+
name: 'DemoPage',
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
const docName = ref('');
|
|
52
|
+
const deleteSlideErrInfo = ref('');
|
|
53
|
+
|
|
54
|
+
const isWindowSelectionChangeRegister = ref(false);
|
|
55
|
+
const WindowSelectionChangeInfo = ref('');
|
|
56
|
+
|
|
57
|
+
const isNewSlideEventRegister = ref(false);
|
|
58
|
+
const NewSlideEventInfo = ref('');
|
|
59
|
+
|
|
60
|
+
const putShapeValue = () => {
|
|
61
|
+
const pres = Application.ActivePresentation;
|
|
62
|
+
if (pres) {
|
|
63
|
+
if (pres.Slides.Item(1)) {
|
|
64
|
+
const shapes = pres.Slides.Item(1).Shapes;
|
|
65
|
+
let shape = null;
|
|
66
|
+
if (shapes.Count > 0) {
|
|
67
|
+
shape = shapes.Item(1);
|
|
68
|
+
} else {
|
|
69
|
+
shape = shapes.AddTextbox(3, 25, 30, 350, 350);
|
|
70
|
+
}
|
|
71
|
+
if (shape) {
|
|
72
|
+
shape.TextFrame.TextRange.Text = "Hello, uudev!" + shape.TextFrame.TextRange.Text;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
const getDocInfo = () => {
|
|
79
|
+
const pres = Application.ActivePresentation;
|
|
80
|
+
if (pres) {
|
|
81
|
+
docName.value = `文档名称: ${pres.Name}`;
|
|
82
|
+
const info = `文档名称: ${pres.Name}\n文档路径: ${pres.FullName}`;
|
|
83
|
+
console.log(info);
|
|
84
|
+
} else {
|
|
85
|
+
docName.value = '';
|
|
86
|
+
alert('没有打开的文档');
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
const clearDocInfo = () => {
|
|
91
|
+
docName.value = '';
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
const addSlide = () => {
|
|
95
|
+
const pres = Application.ActivePresentation;
|
|
96
|
+
if (pres) {
|
|
97
|
+
const newIndex = pres.Slides.Count + 1;
|
|
98
|
+
pres.Slides.Add(newIndex, 12); // 12 = ppLayoutBlank
|
|
99
|
+
deleteSlideErrInfo.value = '';
|
|
100
|
+
} else {
|
|
101
|
+
alert('没有打开的文档');
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
const deleteCurrentSlide = () => {
|
|
106
|
+
const pres = Application.ActivePresentation;
|
|
107
|
+
if (!pres) {
|
|
108
|
+
alert('没有打开的文档');
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
111
|
+
if (pres.Slides.Count > 1) {
|
|
112
|
+
const view = Application.ActiveWindow.View;
|
|
113
|
+
if (view && view.Slide) {
|
|
114
|
+
view.Slide.Delete();
|
|
115
|
+
deleteSlideErrInfo.value = '';
|
|
116
|
+
}
|
|
117
|
+
} else {
|
|
118
|
+
deleteSlideErrInfo.value = '最后一个幻灯片不能删除';
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
const regWindowSelectionChange = () => {
|
|
123
|
+
if (isWindowSelectionChangeRegister.value) {
|
|
124
|
+
Application.MountEvent(eppWindowSelectionChange, (sel: Selection) => {
|
|
125
|
+
if (sel && sel.Type === 1) { // ppSelectionShapes
|
|
126
|
+
const shapeRange = sel.ShapeRange;
|
|
127
|
+
if (shapeRange && shapeRange.Count > 0) {
|
|
128
|
+
WindowSelectionChangeInfo.value = `选中了 ${shapeRange.Count} 个形状`;
|
|
129
|
+
}
|
|
130
|
+
} else if (sel && sel.Type === 2) { // ppSelectionText
|
|
131
|
+
const textRange = sel.TextRange;
|
|
132
|
+
if (textRange) {
|
|
133
|
+
WindowSelectionChangeInfo.value = `选中了文本: "${textRange.Text.substring(0, 20)}"`;
|
|
134
|
+
}
|
|
135
|
+
} else if (sel && sel.SlideRange) {
|
|
136
|
+
WindowSelectionChangeInfo.value = `选中了幻灯片`;
|
|
137
|
+
} else {
|
|
138
|
+
WindowSelectionChangeInfo.value = '选中区域已改变';
|
|
139
|
+
}
|
|
140
|
+
});
|
|
141
|
+
} else {
|
|
142
|
+
Application.UnMountEvent(eppWindowSelectionChange);
|
|
143
|
+
WindowSelectionChangeInfo.value = '';
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
const regNewSlideEvent = () => {
|
|
148
|
+
const onNewSlide = (sld: Slide) => {
|
|
149
|
+
NewSlideEventInfo.value = `新建了幻灯片: ${sld.SlideIndex}`;
|
|
150
|
+
};
|
|
151
|
+
if (isNewSlideEventRegister.value) {
|
|
152
|
+
Application.MountEvent(eppPresentationNewSlide, onNewSlide);
|
|
153
|
+
} else {
|
|
154
|
+
Application.UnMountEvent(eppPresentationNewSlide, onNewSlide);
|
|
155
|
+
NewSlideEventInfo.value = '';
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
</script>
|
|
159
|
+
<style scoped>
|
|
160
|
+
.demoHref {
|
|
161
|
+
color: #42b983;
|
|
162
|
+
cursor: pointer;
|
|
163
|
+
text-decoration: underline;
|
|
164
|
+
margin-right: 50px;
|
|
165
|
+
}
|
|
166
|
+
</style>
|