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数据挖掘平台介绍(五) 数据导入导出向导和报告生成
一. 前言 经过了一个多月的努力,软件系统又添加了不少新功能.这些功能包括非常实用的数据导入导出,对触摸进行优化的画布和画笔工具,以及对一些智能分析的报告生成模块等.进一步加强了平台系统级的功能. 马 ...
随机推荐
- Stylus基本使用
介绍 在学习一个 Vue.js 项目的过程中,注意到源码中样式的部分并没有用熟悉的 .css 样式文件,而是发现了代码长得和 CSS 相像的 .styl 文件.这个 .styl 以前没见过啊,你是谁? ...
- cf232E. Quick Tortoise(分治 bitset dp)
题意 题目链接 Sol 感觉这个思路还是不错的 #include<bits/stdc++.h> using namespace std; const int MAXN = 501, SS ...
- element-ui Progress、Badge、Alert组件源码分析整理笔记(四)
Progress进度条组件 <template> <!--最外层--> <div class="el-progress" :class="[ ...
- HTML(5)基础
1.html常用标签 <pre>...</pre>:标识预定义文本 <a>是anchor的缩写,<a>标签定义锚点和超链接,<a>常与hre ...
- 【mpvue】使用Mpvue撸一个简单的小程序
一.快速创建一个mpvue项目 全局安装 vue-cli (如果有就不需要装了) 创建一个基于mpvue-quickstart模板的新项目,记得选择安装vuex vue init mpvue/ ...
- nginx www解析失败问题解决
nginx www解析失败: nginx代理IIS下域名时 xxxx.xxx可以解析 但www.xxxx.xxx解析失败 IIS增加ip解析:配置下127.0.0.1就可以解析了.
- TI(德州仪器) TMS320C674x逆向分析之二
TI官网文档: http://www.ti.com/product/tms320c6745/technicaldocuments 里面资料非常详细,可以对着里面一个个看,用的比较多的两个文档: TMS ...
- Oracle EBS INV 更新物料慢
失效 ICX SELECT FA.APPLICATION_SHORT_NAME, FA.APPLICATION_ID, PI.STATUS, PI.PRODUCT_VERSION, PI.PATCH_ ...
- 转:C#综合揭秘——细说多线程(上)
原文地址:http://www.cnblogs.com/leslies2/archive/2012/02/07/2310495.html 引言 本文主要从线程的基础用法,CLR线程池当中工作者线程与I ...
- 转:前端js、jQuery实现日期格式化、字符串格式化
1. js仿后台的字符串的StringFormat方法 在做前端页面时候,经常会对字符串进行拼接处理,但是直接使用字符串拼接,不但影响阅读,而且影响执行效率,且jQuery有没有定义字符串的Strin ...