uudev 1.0.0 → 1.1.1

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.
@@ -7,10 +7,10 @@
7
7
  "author": "uuer",
8
8
  "type": "module",
9
9
  "scripts": {
10
- "dev": "vite --port 41260",
11
- "build": "run-p type-check \"build-only {@}\" --",
12
10
  "debug": "uudev debug",
13
- "publish": "uudev publish",
11
+ "makezip": "uudev makezip",
12
+ "dev": "vite",
13
+ "build": "run-p type-check \"build-only {@}\" --",
14
14
  "preview": "vite preview",
15
15
  "build-only": "vite build",
16
16
  "type-check": "vue-tsc --build",
@@ -0,0 +1,13 @@
1
+
2
+
3
+ <template>
4
+ <RouterView />
5
+ </template>
6
+
7
+ <script setup lang="ts">
8
+ import { RouterView, useRoute } from 'vue-router'
9
+ const route = useRoute()
10
+ </script>
11
+ <style scoped>
12
+
13
+ </style>
@@ -0,0 +1,51 @@
1
+
2
+
3
+ <template>
4
+ <h1>欢迎使用uudev系列工具</h1>
5
+ <p>
6
+ uudev是一个基于TypeScript的Office开发工具集,提供了丰富的类型定义和开发支持,帮助开发者更高效地构建Office插件和应用。
7
+ </p>
8
+ <h3>Excel运行示例</h3>
9
+ <div>
10
+ <a class="demoHref" @click="putCellValue">给选中的单元格赋值</a>(代码:Application.ActiveCell.Formula = 'Hello, uudev!')
11
+ </div>
12
+ <div>
13
+ <a class="demoHref" @click="getDocInfo">取文档信息</a>
14
+ <a class="demoHref" @click="clearDocInfo">清除文档信息</a>
15
+ <span>{{ docName }}</span>(代码:Application.ActiveWorkbook.Name)
16
+ </div>
17
+ </template>
18
+
19
+ <script setup lang="ts">
20
+ import { ref } from 'vue';
21
+ const putCellValue = () => {
22
+ const activeCell = Application.ActiveCell;
23
+ if (activeCell) {
24
+ activeCell.Formula = 'Hello, uudev!';
25
+ }
26
+ }
27
+
28
+ var docName = ref('');
29
+ const getDocInfo=() => {
30
+ const doc = Application.ActiveWorkbook
31
+ if (doc) {
32
+ docName.value = `文档名称: ${doc.Name}`;
33
+ const info = `文档名称: ${doc.Name}\n文档路径: ${doc.FullName}`;
34
+ console.log(info);
35
+ } else {
36
+ docName.value = '';
37
+ alert('没有打开的文档');
38
+ }
39
+ }
40
+ const clearDocInfo = () => {
41
+ docName.value = '';
42
+ }
43
+ </script>
44
+ <style scoped>
45
+ .demoHref {
46
+ color: #42b983;
47
+ cursor: pointer;
48
+ text-decoration: underline;
49
+ margin-right: 50px;
50
+ }
51
+ </style>
@@ -0,0 +1,19 @@
1
+ import { createRouter, createWebHashHistory } from 'vue-router'
2
+
3
+ const router = createRouter({
4
+ history: createWebHashHistory(import.meta.env.BASE_URL),
5
+ routes: [
6
+ {
7
+ path: '/',
8
+ name: 'home',
9
+ redirect: 'demo'
10
+ },
11
+ {
12
+ path: '/demo',
13
+ name: 'demo',
14
+ component: () => import('../demo/demo.vue')
15
+ }
16
+ ],
17
+ })
18
+
19
+ export default router
@@ -0,0 +1,13 @@
1
+
2
+
3
+ <template>
4
+ <RouterView />
5
+ </template>
6
+
7
+ <script setup lang="ts">
8
+ import { RouterView, useRoute } from 'vue-router'
9
+ const route = useRoute()
10
+ </script>
11
+ <style scoped>
12
+
13
+ </style>
@@ -0,0 +1,63 @@
1
+
2
+
3
+ <template>
4
+ <h1>欢迎使用uudev系列工具</h1>
5
+ <p>
6
+ uudev是一个基于TypeScript的Office开发工具集,提供了丰富的类型定义和开发支持,帮助开发者更高效地构建Office插件和应用。
7
+ </p>
8
+ <h3>Ppt运行示例</h3>
9
+ <div>
10
+ <a class="demoHref" @click="putShapeValue">给形状赋值</a>(代码:Application.ActivePresentation.Slides.Item(1).Shapes.Item(1).TextFrame.TextRange.Text = 'Hello, uudev!')
11
+ </div>
12
+ <div>
13
+ <a class="demoHref" @click="getDocInfo">取文档信息</a>
14
+ <a class="demoHref" @click="clearDocInfo">清除文档信息</a>
15
+ <span>{{ docName }}</span>(代码:Application.ActivePresentation.Name)
16
+ </div>
17
+ </template>
18
+
19
+ <script setup lang="ts">
20
+ import { ref } from 'vue';
21
+ const putShapeValue = () => {
22
+ let doc = Application.ActivePresentation
23
+ if (doc){
24
+ if (doc.Slides.Item(1)){
25
+ let shapes = doc.Slides.Item(1).Shapes
26
+ let shape = null
27
+ if (shapes.Count > 0){
28
+ shape = shapes.Item(1)
29
+ }else{
30
+ shape = shapes.AddTextbox(3, 25,30,350,350)
31
+ }
32
+ if (shape){
33
+ shape.TextFrame.TextRange.Text="Hello, uudev!" + shape.TextFrame.TextRange.Text
34
+ }
35
+ }
36
+ }
37
+
38
+ }
39
+
40
+ var docName = ref('');
41
+ const getDocInfo=() => {
42
+ const doc = Application.ActivePresentation;
43
+ if (doc) {
44
+ docName.value = `文档名称: ${doc.Name}`;
45
+ const info = `文档名称: ${doc.Name}\n文档路径: ${doc.FullName}`;
46
+ console.log(info);
47
+ } else {
48
+ docName.value = '';
49
+ alert('没有打开的文档');
50
+ }
51
+ }
52
+ const clearDocInfo = () => {
53
+ docName.value = '';
54
+ }
55
+ </script>
56
+ <style scoped>
57
+ .demoHref {
58
+ color: #42b983;
59
+ cursor: pointer;
60
+ text-decoration: underline;
61
+ margin-right: 50px;
62
+ }
63
+ </style>
@@ -0,0 +1,9 @@
1
+ import { createApp } from 'vue'
2
+ import App from './App.vue'
3
+ import router from './router'
4
+
5
+ const app = createApp(App)
6
+
7
+ app.use(router)
8
+
9
+ app.mount('#app')
@@ -0,0 +1,19 @@
1
+ import { createRouter, createWebHashHistory } from 'vue-router'
2
+
3
+ const router = createRouter({
4
+ history: createWebHashHistory(import.meta.env.BASE_URL),
5
+ routes: [
6
+ {
7
+ path: '/',
8
+ name: 'home',
9
+ redirect: 'demo'
10
+ },
11
+ {
12
+ path: '/demo',
13
+ name: 'demo',
14
+ component: () => import('../demo/demo.vue')
15
+ }
16
+ ],
17
+ })
18
+
19
+ export default router
@@ -0,0 +1,13 @@
1
+
2
+
3
+ <template>
4
+ <RouterView />
5
+ </template>
6
+
7
+ <script setup lang="ts">
8
+ import { RouterView, useRoute } from 'vue-router'
9
+ const route = useRoute()
10
+ </script>
11
+ <style scoped>
12
+
13
+ </style>
@@ -0,0 +1,51 @@
1
+
2
+
3
+ <template>
4
+ <h1>欢迎使用uudev系列工具</h1>
5
+ <p>
6
+ uudev是一个基于TypeScript的Office开发工具集,提供了丰富的类型定义和开发支持,帮助开发者更高效地构建Office插件和应用。
7
+ </p>
8
+ <h3>Word运行示例</h3>
9
+ <div>
10
+ <a class="demoHref" @click="putRangeValue">给文档开头赋值</a>(代码:Application.ActiveDocument.Range(0).Text = "Hello, uudev!')
11
+ </div>
12
+ <div>
13
+ <a class="demoHref" @click="getDocInfo">取文档信息</a>
14
+ <a class="demoHref" @click="clearDocInfo">清除文档信息</a>
15
+ <span>{{ docName }}</span>(代码:Application.ActiveDocument.Name)
16
+ </div>
17
+ </template>
18
+
19
+ <script setup lang="ts">
20
+ import { ref } from 'vue';
21
+ const putRangeValue = () => {
22
+ const doc = Application.ActiveDocument;
23
+ if (doc) {
24
+ doc.Range(0, 0).Text = "Hello, uudev!";
25
+ }
26
+ }
27
+
28
+ var docName = ref('');
29
+ const getDocInfo=() => {
30
+ const doc = Application.ActiveDocument
31
+ if (doc) {
32
+ docName.value = `文档名称: ${doc.Name}`;
33
+ const info = `文档名称: ${doc.Name}\n文档路径: ${doc.FullName}`;
34
+ console.log(info);
35
+ } else {
36
+ docName.value = '';
37
+ alert('没有打开的文档');
38
+ }
39
+ }
40
+ const clearDocInfo = () => {
41
+ docName.value = '';
42
+ }
43
+ </script>
44
+ <style scoped>
45
+ .demoHref {
46
+ color: #42b983;
47
+ cursor: pointer;
48
+ text-decoration: underline;
49
+ margin-right: 50px;
50
+ }
51
+ </style>
@@ -0,0 +1,9 @@
1
+ import { createApp } from 'vue'
2
+ import App from './App.vue'
3
+ import router from './router'
4
+
5
+ const app = createApp(App)
6
+
7
+ app.use(router)
8
+
9
+ app.mount('#app')
@@ -0,0 +1,19 @@
1
+ import { createRouter, createWebHashHistory } from 'vue-router'
2
+
3
+ const router = createRouter({
4
+ history: createWebHashHistory(import.meta.env.BASE_URL),
5
+ routes: [
6
+ {
7
+ path: '/',
8
+ name: 'home',
9
+ redirect: 'demo'
10
+ },
11
+ {
12
+ path: '/demo',
13
+ name: 'demo',
14
+ component: () => import('../demo/demo.vue')
15
+ }
16
+ ],
17
+ })
18
+
19
+ export default router
@@ -6,6 +6,8 @@
6
6
  // Extra safety for array and object lookups, but may have false positives.
7
7
  "noUncheckedIndexedAccess": true,
8
8
 
9
+ "types": ["uudev"],
10
+
9
11
  // Path mapping for cleaner imports.
10
12
  "paths": {
11
13
  "@/*": ["./src/*"]
@@ -1,6 +1,6 @@
1
1
  // TSConfig for modules that run in Node.js environment via either transpilation or type-stripping.
2
2
  {
3
- "extends": "@tsconfig/node24/tsconfig.json",
3
+ "extends": "./node_modules/@tsconfig/node24/tsconfig.json",
4
4
  "include": [
5
5
  "vite.config.*",
6
6
  "vitest.config.*",
@@ -1,18 +1,17 @@
1
1
  import { fileURLToPath, URL } from 'node:url'
2
2
 
3
3
  import { defineConfig } from 'vite'
4
- import vue from '@vitejs/plugin-vue'
5
- import vueDevTools from 'vite-plugin-vue-devtools'
4
+ import vue from './node_modules/@vitejs/plugin-vue'
6
5
 
7
6
  // https://vite.dev/config/
8
7
  export default defineConfig({
8
+ base: './',
9
9
  plugins: [
10
10
  vue(),
11
- vueDevTools(),
12
11
  ],
13
12
  server: {
14
13
  port: 41260,
15
- strictPort: true,
14
+ strictPort: false,
16
15
  open: false,
17
16
  host: '0.0.0.0'
18
17
  },
@@ -0,0 +1,5 @@
1
+ interface Application {
2
+ shell: {
3
+ openExternal: (url: string) => void;
4
+ };
5
+ }