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. koajs项目之memcached实现session共享

    在做nodejs服务的负载时要考虑到session共享的问题,一般常用的就是memcached方式实现的,本文主要介绍通过npm社区的几个模块轻松实现这个功能. 做koa的session一般会想到用k ...

  2. TensorFlow Saver 保存最佳模型 tf.train.Saver Save Best Model

      TensorFlow Saver 保存最佳模型 tf.train.Saver Save Best Model Checkmate is designed to be a simple drop-i ...

  3. Origin绘制双Y轴图的方法

    1.已有数据绘图如下,其中网络流量的单位是M Bytes/s,与另外两组数据的单位(时间)不同,现在要为其添加右侧Y轴. 2.首先选中该图像,找到工具条,点击第三个按钮“Add Right-Y Lay ...

  4. PHPCMS V9开发文档

    内容模块 内容模块PC标签调用说明 模块名:content 模块提供的可用操作 操作名 说明 lists 内容数据列表 relation 内容相关文章 hits 内容数据点击排行榜 category ...

  5. Mockjs 前端接口数据模拟

    在前后端分离的项目中,通常需要启动一个后台服务器来配合前端项目的接口需求.Mockjs的作用是拦截ajax请求并模拟各种数据返回,让前端开发可以更加自由独立. 安装 npm install mockj ...

  6. Android解析WindowManager(一)WindowManager体系

    前言 WindowManagerService(WMS)和AMS一样,都是Android开发需要掌握的知识点,同样的,WMS也很复杂,需要多篇文章来进行讲解,为何更好的理解WMS,首先要了解Windo ...

  7. Sql server 索引详解

    参考资料:老K写的,http://www.cnblogs.com/AK2012/archive/2013/01/04/2844283.html SQL索引在数据库优化中占有一个非常大的比例, 一个好的 ...

  8. 浅尝Java(一)

    主题:数据类型,数值类型变量相互转化 Java是强类型的语言,与JavaScript(松散型)在数据类型上有很大的差异(1.所有变量必须先申明,后使用:2.指定类型的变量只接受与之匹配类型的值).这个 ...

  9. 从零自学Java-6.使用循环重复执行操作

    1.使用for循环: 2.使用while循环: 3.使用do-while循环: 4.提早退出循环(break,continue): 5.为循环命名. 程序Nines:显示1-200的整数与9的乘积 p ...

  10. python设计模式之门面模式

    一.结构型设计模式 门面模式与单例模式,工厂模式不同,它是一种结构型模式. 结构型模式描述如何将对象和类组合成更大的结构 结构型模式是一种能够简化设计工作的模式,它能找出更简单的方法来认识或表示实体之 ...