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. JS实现选择菜单栏(配合慕课网淘宝搜索框的课程)

    以下是关于实现慕课网淘宝搜索框的JS代码,不过只有选择菜单栏(其余比较容易实现). <!doctype html> <html> <head> <!--在IE ...

  2. SAP FI/CO 基本概念

    每一个SAP从业者都对这些概念不陌生,理解透了这些概念,对SAP的业务体系构架才能有明确地认识. 1.集团(client)的概念:是SAP中的最高等级:每一个集团建立主数据库. 2.公司(Compan ...

  3. 护网杯 task_shoppingCart 记录

    前言 相关题目位于 https://gitee.com/hac425/blog_data/tree/master/hwb task_shoppingCart 漏洞位于 00BD9 用户输入 idx 然 ...

  4. url override and HttpSession implements session for form

    url 重写结合HttpSession实现会话管理之 form 提交 package com.test; import javax.servlet.ServletException; import j ...

  5. servlet和jsp页面过滤器Filter的作用及配置

    刚刚有个朋友问我,Servlet的过滤器有什么作用? 现在发个帖子说明一下,            过滤器是一个对象,可以传输请求或修改响应.它可以在请求到达Servlet/JSP之前对其进行预处理, ...

  6. linq not in 查询

    想要的sql: select A.* from BL_BCSS_Invoice A join BL_BCSS_OfflineInvoice B on A.ID!=B.InvoiceID; 不知道如何写 ...

  7. Oracle EBS 用户职责人员取值

    SELECT fu.user_name 用户名, fu.description 用户说明, fu.start_date 用户启用日期, fu.end_date 用户终止日期 --,fu.employe ...

  8. SQL Server 从2000复制数据到2008及以上版本的一种方法

    1.通过Linked Servers 执行sql出现错误提示,无法执行复制数据操作. sql: insert into tb_User select from [**.**.*.**].DB.dbo. ...

  9. xml 注意事项

      <?xml version="1.0" encoding="GB2312"?> xml区分大小写,只能有一个根元素,属性值必须放在引号中,空格不 ...

  10. CentOS7 安装 JDK

    安装步骤 1. 将 jdk 安装包传到 用户 centos 的 home 目录 (/home/centos) 通过 Xftp 将安装包( jdk-8u161-linux-x64.tar.gz )传到用 ...