word导入导出自定义属性列表
Sub ExportCustom()
'
' ExportCustom 宏
' 导出自定义属性到custom.txt
'
Dim lFileNumber As Long
Dim sFilePath As String
Dim current As Object
Set current = ActiveDocument
sFilePath = current.Path + "\Custom.txt"
lFileNumber = FreeFile()
Open sFilePath For Output As #lFileNumber
Dim i As Integer
For Each objProp In current.CustomDocumentProperties
Dim bRegular As Boolean
bRegular = True
If objProp.Name = "ProprietaryDeclaration" Then
bRegular = False
End If
If objProp.Name = "slevel" Then
bRegular = False
End If
If objProp.Name = "slevelui" Then
bRegular = False
End If
If objProp.Name = "sflag" Then
bRegular = False
End If
If bRegular Then
Print #lFileNumber, objProp.Name & vbTab & objProp.Value
End If
Next Close #lFileNumber
MsgBox "导出完毕!"
End Sub
Sub UpdateCustom()
'
' UpdateCustom 宏
'
'
Dim strUpdateContent As String
Dim strNotFoundProperty As String Dim current As Object
Set current = ActiveDocument
Dim lFileNumber As Long
lFileNumber = FreeFile()
Open current.Path + "\Custom.txt" For Input As #lFileNumber ' 打开文件。
Dim TextLine As String
Dim tmpObj As Object
Dim iTabIndex As Integer
Do While Not EOF(lFileNumber) ' 循环至文件尾。
Line Input #lFileNumber, TextLine ' 读入一行数据并将其赋予某变量。 If Not (TextLine = "") Then iTabIndex = InStr(TextLine, vbTab)
If Not (iTabIndex = Or iTabIndex = Or iTabIndex = Len(TextLine)) Then Dim strName As String
Dim strValue As String strName = Mid(TextLine, , iTabIndex - )
Debug.Print strName ' 在调试窗口中显示数据。
strValue = Mid(TextLine, iTabIndex + )
Debug.Print strValue ' 在调试窗口中显示数据。 On Error Resume Next
Set tmpObj = Nothing
Set tmpObj = current.CustomDocumentProperties(strName)
On Error GoTo
If Not (tmpObj Is Nothing) Then
If (tmpObj.Type = msoPropertyTypeString And (Not (tmpObj.Value = strValue))) Then
strUpdateContent = strUpdateContent & vbCrLf & tmpObj.Name & vbTab & tmpObj.Value & "==>>" & strValue
tmpObj.Value = strValue
End If
Else
strNotFoundProperty = strNotFoundProperty & vbCrLf & strName
End If
End If End If Loop Dim strMsg As String
If Not (strUpdateContent = "") Then
strMsg = strMsg & "Update content:" & strUpdateContent
End If If Not (strNotFoundProperty = "") Then
strMsg = strMsg & "Not found property:" & strNotFoundProperty
End If If (strMsg = "") Then
strMsg = "No Update"
End If MsgBox strMsg End Sub Sub SortCustom()
'
' SortCustom 宏
'
'
Dim current As Object
Set current = ActiveDocument
sFilePath = current.Path + "\Custom.txt"
Dim propertys() As Object
'Set propertys = current.CustomDocumentProperties
Dim iPropLen As Integer
iPropLen = current.CustomDocumentProperties.Count
Dim i As Integer
Dim iTmpPropLen As Integer
iTmpPropLen = iPropLen
Dim bFlag As Boolean
bFlag = True
Do While bFlag And iTmpPropLen >
bFlag = False
For i = To (iTmpPropLen - )
If current.CustomDocumentProperties(i).Name > current.CustomDocumentProperties(i + ).Name Then
bFlag = True Dim tmpProp1 As Object
Set tmpProp1 = current.CustomDocumentProperties(i)
Dim tmpProp2 As Object
Set tmpProp2 = current.CustomDocumentProperties(i + ) Dim tmpPropName As String
Dim tmpPropType As Integer
Dim tmpPropLinkToContent As Boolean
Dim tmpPropValue As String
tmpPropName = tmpProp1.Name
tmpPropType = tmpProp1.Type
tmpPropLinkToContent = tmpProp1.LinkToContent
tmpPropValue = tmpProp1.Value
tmpProp1.Name = "tmp"
tmpProp1.Type = msoPropertyTypeString
tmpProp1.LinkToContent = False
tmpProp1.Value = "tmp" Dim tmpPropName2 As String
Dim tmpPropType2 As Integer
Dim tmpPropLinkToContent2 As Boolean
Dim tmpPropValue2 As String
tmpPropName2 = tmpProp2.Name
tmpPropType2 = tmpProp2.Type
tmpPropLinkToContent2 = tmpProp2.LinkToContent
tmpPropValue2 = tmpProp2.Value
tmpProp2.Name = tmpPropName
tmpProp2.Type = tmpPropType
tmpProp2.LinkToContent = tmpPropLinkToContent
tmpProp2.Value = tmpPropValue tmpProp1.Name = tmpPropName2
tmpProp1.Type = tmpPropType2
tmpProp1.LinkToContent = tmpPropLinkToContent2
tmpProp1.Value = tmpPropValue2
End If
Next
iTmpPropLen = iTmpPropLen -
Loop MsgBox "排序完毕!"
End Sub
word导入导出自定义属性列表的更多相关文章
- 【解决】如何导入导出SharePoint列表和文档库
早期的SharePoint管理工具stsadm.exe只能导出/导入网站,但不能导出/导入列表和文档库.但在PowerShell增加了此命令,具体操作如下. I. 导出列表或文档库 Export-SP ...
- java word导入导出工具类
package com.shareworx.yjwy.utils; import java.io.InputStream; import java.util.HashMap; import java. ...
- 文件上传下下载(不包含断点续传) Excel,Word导入导出基础
1.文件上传下载(MVC应用) 视图:form表单,编码方式为multipart/form-data <body> <div> <form action="/D ...
- service2008 word 导入导出 配置问题
除了配置 com组件权限 64位系统还要加 下面的文件 C:\Windows\SysWOW64\config\systemprofile\Desktop C:\Windows\Temp 也要加权限
- 数据库数据导入导出系列之五 C#实现动态生成Word(转)
1. 一个控制台例子,实现动态生成Word. 首先,添加引用:COM->Microsoft Word 11.0 Object Library. 2. 介绍几篇牛人写的关于操作Word的文章 [分 ...
- python 全栈开发,Day126(创业故事,软件部需求,内容采集,显示内容图文列表,MongoDB数据导入导出JSON)
作业讲解 下载代码: HBuilder APP和flask后端登录 链接:https://pan.baidu.com/s/1eBwd1sVXTNLdHwKRM2-ytg 密码:4pcw 如何打开APP ...
- 软件部需求,内容采集,显示内容图文列表,MongoDB数据导入导出JSON
全局变量 由于多个html页面,需要引用同一个变量.这个时候,需要定义一个全局变量!如何定义呢? 默认包含了mui的html文件都导入mui.js文件.那么将变量写在mui.js中,就可以实现所有页面 ...
- EasyOffice-.NetCore一行代码导入导出Excel,生成Word
简介 Excel和Word操作在开发过程中经常需要使用,这类工作不涉及到核心业务,但又往往不可缺少.以往的开发方式在业务代码中直接引入NPOI.Aspose或者其他第三方库,工作繁琐,耗时多,扩展性差 ...
- ITTC数据挖掘平台介绍(五) 数据导入导出向导和报告生成
一. 前言 经过了一个多月的努力,软件系统又添加了不少新功能.这些功能包括非常实用的数据导入导出,对触摸进行优化的画布和画笔工具,以及对一些智能分析的报告生成模块等.进一步加强了平台系统级的功能. 马 ...
随机推荐
- js-ES6学习笔记-Proxy
1.Proxy 用于修改某些操作的默认行为,等同于在语言层面做出修改,所以属于一种“元编程”(meta programming),即对编程语言进行编程. 2.Proxy 可以理解成,在目标对象之前架设 ...
- 记录常用的git命令
之前的公司都是用svn的,现在的公司用git了,所以现在记录一下所用到的git命令,方便以后查看! git 常用命令 git add git add 命令可将该文件添加到缓存 git add . // ...
- 【mpvue】使用Mpvue撸一个简单的小程序
一.快速创建一个mpvue项目 全局安装 vue-cli (如果有就不需要装了) 创建一个基于mpvue-quickstart模板的新项目,记得选择安装vuex vue init mpvue/ ...
- Asp.Net Core混合使用cookie和JwtBearer认证方案
自己有时捣鼓一些小型演示项目,服务端主要是提供Web Api功能.为了便于管理,需要在服务端加一些简单的MVC网页,用管理员身份登录,做一些简单的操作. 因此需要实现一个功能,在一个Asp.Net C ...
- 用例设计之API用例覆盖准则
基本原则 本文主要讨论API测试的用例/场景覆盖,基本原则如下: 用户场景闭环(从哪来到哪去) 遍历所有的实现逻辑路径 需求点覆盖 覆盖维度 API协议(参数&业务场景) 中间件检查 异常场景 ...
- LeetCode题解之Rotated Digits
1.题目描述 2.代码 int rotatedDigits(int N) { ; ; i <= N; i++) { if (isGood(i)) { res++; } } return res; ...
- LeetCoder题解之Find All Anagrams in a String
1.题目描述 2.题目分析 直接使用 哈希表记录子串的信息,然后对比两个哈希表信息即可 3.代码 vector<int> findAnagrams(string s, string p) ...
- MariaDB实现主从配置及读写分离(一)
一.主从复制方案 1. 在两台CentOS7虚拟机上分别部署MariaDB, 主数据库服务器IP为192.168.17.235, 从服务器IP为192.168.17.238. 从服务器通过调取主服务 ...
- innodb_file_per_table - 转换为InnoDB
共享InnoDB / var / lib / mysql / ibdata1存储的问题InnoDB表当前将数据和索引存储到共享表空间(/ var / lib / mysql / ibdata1).由于 ...
- Java-控制台传递参数
今天组长叫我把所有的参数(写死的),用控制器输入,使其变成可变的. ------我的程序是需要读取文件的,控制台输入即,是文件放在哪我都可以读取. 比如我需要读取的demo.txt文件在D盘根目录下, ...