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导入导出自定义属性列表的更多相关文章

  1. 【解决】如何导入导出SharePoint列表和文档库

    早期的SharePoint管理工具stsadm.exe只能导出/导入网站,但不能导出/导入列表和文档库.但在PowerShell增加了此命令,具体操作如下. I. 导出列表或文档库 Export-SP ...

  2. java word导入导出工具类

    package com.shareworx.yjwy.utils; import java.io.InputStream; import java.util.HashMap; import java. ...

  3. 文件上传下下载(不包含断点续传) Excel,Word导入导出基础

    1.文件上传下载(MVC应用) 视图:form表单,编码方式为multipart/form-data <body> <div> <form action="/D ...

  4. service2008 word 导入导出 配置问题

    除了配置 com组件权限 64位系统还要加 下面的文件 C:\Windows\SysWOW64\config\systemprofile\Desktop C:\Windows\Temp 也要加权限

  5. 数据库数据导入导出系列之五 C#实现动态生成Word(转)

    1. 一个控制台例子,实现动态生成Word. 首先,添加引用:COM->Microsoft Word 11.0 Object Library. 2. 介绍几篇牛人写的关于操作Word的文章 [分 ...

  6. python 全栈开发,Day126(创业故事,软件部需求,内容采集,显示内容图文列表,MongoDB数据导入导出JSON)

    作业讲解 下载代码: HBuilder APP和flask后端登录 链接:https://pan.baidu.com/s/1eBwd1sVXTNLdHwKRM2-ytg 密码:4pcw 如何打开APP ...

  7. 软件部需求,内容采集,显示内容图文列表,MongoDB数据导入导出JSON

    全局变量 由于多个html页面,需要引用同一个变量.这个时候,需要定义一个全局变量!如何定义呢? 默认包含了mui的html文件都导入mui.js文件.那么将变量写在mui.js中,就可以实现所有页面 ...

  8. EasyOffice-.NetCore一行代码导入导出Excel,生成Word

    简介 Excel和Word操作在开发过程中经常需要使用,这类工作不涉及到核心业务,但又往往不可缺少.以往的开发方式在业务代码中直接引入NPOI.Aspose或者其他第三方库,工作繁琐,耗时多,扩展性差 ...

  9. ITTC数据挖掘平台介绍(五) 数据导入导出向导和报告生成

    一. 前言 经过了一个多月的努力,软件系统又添加了不少新功能.这些功能包括非常实用的数据导入导出,对触摸进行优化的画布和画笔工具,以及对一些智能分析的报告生成模块等.进一步加强了平台系统级的功能. 马 ...

随机推荐

  1. layer弹出框确定前验证:弹出消息框(弹出两个layer)

    作者QQ:1095737364 QQ群:123300273 欢迎加入! layer 弹出框中经常遇到要弹出表单进行修改数据, 因此在弹出框中的表单需要验证数据, 就需要在弹出一个layer, 默认的设 ...

  2. 4.SSM配置shiro权限管理

    作者QQ:1095737364    QQ群:123300273     欢迎加入! 1.搭建SSM项目: http://www.cnblogs.com/yysbolg/p/6909021.html ...

  3. 设计模式(13)--Chain of Responsibility(责任链模式)--行为型

    作者QQ:1095737364    QQ群:123300273     欢迎加入! 1.模式定义: 责任链模式是一种对象的行为模式.在责任链模式里,很多对象由每一个对象对其下家的引用而连接起来形成一 ...

  4. unity中生成一个GUI格子(始终居中)

    1.Script程序 using UnityEngine; using System.Collections; public class GUITest : MonoBehaviour { [Seri ...

  5. js-ES6学习笔记-Generator函数的应用

    1.异步操作的同步化表达 Generator函数的暂停执行的效果,意味着可以把异步操作写在yield语句里面,等到调用next方法时再往后执行.这实际上等同于不需要写回调函数了,因为异步操作的后续操作 ...

  6. 《Spring实战》-- 'cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element' 错误的解决办法

    在Eclipse中新建了一个maven项目学习Spring,在 service.xml 中配置 Spring,想要学习'面向切面的Spring',service.xml 内容如下: <beans ...

  7. 使用IDEA创建Java Web项目并部署

    前面给大家介绍了IDEA的安装和基本配置,睡觉前Alan再给大家分享一下使用IDEA创建Java Web并部署访问. 打开IDEA,File>New>Project,进入Java Ente ...

  8. memcached编译安装报错 ,提示checking build system type... Invalid configuration `x86_64-unknown-linux-': machine `x86_64-unknown-linux' not recognized configure: error: /bin/sh ./config.sub x86_64-unknown-linu

  9. c语言:复合文字

    复合文字的意义,相当于是在C语言中,为数组类型定义了一种类似于8之于int,'w'之于char一样的常量类型,所以从C99之后,可以在一些地方使用复合文字来代替数组使用. 复合文字的声明 (]){,, ...

  10. 解决myeclipse项目中,多出的WebContent文件夹

    由于通过svn导入项目,导致项目中多出WebContent文件夹,而在此之前正常的是WebRoot文件夹.这个WebContent删了之后还会自己冒出来. 直到我发现篇博客:http://blog.s ...