原文链接 :http://blogs.msdn.com/b/ericwhite/archive/2008/09/19/bulk-convert-doc-to-docx.aspx
帮助文档:http://technet.microsoft.com/library/cc179019(office.12).aspx

Microsoft has a bulk conversion utility that can convert multiple DOC files to DOCX files. This blog post presents very basic information on its use. This utility has been around for a while, but a fair number of people don’t know of its existence. Because it’s a powerful tool designed to convert all files on a server (or even a bunch of servers), its use is a little cryptic. This is fine for IT professionals, but if all you want to do is bulk convert a single directory of DOC files, this post shows what you need to do.

Before you can use this tool, you need to install the Microsoft Office Compatibility Pack. While the compatibility pack is primarily used with Office 2003 to allow it to load and save Open XML files, in essence, the compatibility pack is comprised of file format converters, which the Office File Converter (OFC) uses. To use OFC, you need to install the compatibility pack even if you only have Office 2007 installed. Download the compatibility pack here.

Next, you need to download and install the Microsoft Office Migration Planning Manager (OMPM). This contains a bunch of stuff, but for bulk file conversion, we are primarily interested in just one tool, OFC.EXE. Download the Microsoft Office Migration Planning Manager here.

When installing, as usual, you will select the installation directory. OFC.EXE is in the Tools directory under the installation directory. In addition, in that directory, there is a sample OFC.INI file. To run OFC.EXE, you need to create an OFC.INI, and place it in the directory where you run OFC.EXE from.

For my simple example, I want to convert all DOC files found in the C:\Users\ericwhit\Documents\08-09-19-Doc, and place the converted DOCX files in C:\Users\ericwhit\Documents\08-09-19-Docx. Here is the OFC.INI file for this scenario:

[Run]
LogDestinationPath=C:\Users\ericwhit\Documents\08-09-19-Conversion-Log 
TimeOut = 3

[ConversionOptions]
; FullUpgradeOnOpen: if set to 1, Word documents will be fully converted to the OpenXML format
; if set to 0 (default), Word documents will be saved in the OpenXML format in compatibility mode
FullUpgradeOnOpen=1

CABLogs=0

MacroControl=0

[FoldersToConvert]
fldr=C:\Users\ericwhit\Documents\08-09-19-Doc 

[ConversionInfo]
SourcePathTemplate=******************** 
DestinationPathTemplate=C:\Users\ericwhit\Documents\08-09-19-Docx 

The SourcePathTemplate and DestinationPathTemplate provide extremely flexible configuration for bulk conversion of a large number of directories. They allow an IT professional to, say, convert files from one entire server, place the converted files on a different server, and use various sub-paths of the path of the source document to form the path where the DOCX will be placed. Fully configuring SourcePathTemplate and DestinationPathTemplate is beyond the scope of this blog post. The configuration above basically specifies to just take all of the DOC files in the specified fldr directory, and place them in the specified DestinationPathTemplate directory.

So, place a modified version of the above INI file in some directory, and run OFC.EXE from that directory. You will see something like this:

D:\ofc\Tools>ofc.exe
Microsoft Office File Converter version 12.0.4518.1032
Copyright (c) 2006 Microsoft Corporation. All rights reserved.

Automatically converts Office documents to 2007 Microsoft Office system file for
mat based on settings in the OFC.INI control file.

Your newly created DOCX files will be in the directory you specified in DestinationPathTemplate.

这玩意似乎不是很好用,在处理ppt的时候直接死在那了,然后就关闭了,处理word速度很快,有一批文件似乎不成功率很高,用来做生产用,好像还达不到要求。

Bulk Convert DOC to DOCX的更多相关文章

  1. word文档转pdf,支持.doc和.docx,另附抽取pdf指定页数的方法

    公司有个需求,需要将word转成pdf并且抽取首页用以展示,word文档有需要兼容.doc和.docx两种文档格式.其中.docx通过poi直接就可以将word转成pdf,.doc则无法这样实现,上网 ...

  2. 文件在线预览doc,docx转换pdf(一)

    文件在线预览doc,docx转换pdf(一) 1. 前言 文档转换是一个是一块硬骨头,但是也是必不可少的,我们正好做的知识库产品中,也面临着同样的问题,文档转换,精准的全文搜索,知识的转换率,是知识库 ...

  3. 基于java 合并.doc和docx格式的Word文件

    注:摘录自 https://www.cnblogs.com/shenzhouyh/articles/7243805.html 之前用过jacob 合并.doc,但是是有jacob有弊端: 服务器必须是 ...

  4. C#仪器数据文件解析-Word文件(doc、docx)

    不少仪器数据报告输出为Word格式文件,同Excel文件,Word文件doc和docx的存储格式是不同的,相应的解析Word文件的方式也类似,主要有以下方式: 1.通过MS Word应用程序的DCOM ...

  5. java使用poi读取doc和docx文件

    这几天在学习java io流的东西,有一个网友看到博客后问了一个问题,就是说他的doc文档为什么用我所说的方法死活就是乱码. 我一开始以为是他方法问题,结果自己试了之后发现和他的结果一样也是乱码. 于 ...

  6. Python:读取 .doc、.docx 两种 Word 文件简述及“Word 未能引发事件”错误

    概述 Python 中可以读取 word 文件的库有 python-docx 和 pywin32. 下表比较了各自的优缺点.   优点 缺点 python-docx 跨平台 只能处理 .docx 格式 ...

  7. 使用Lucene对doc、docx、pdf、txt文档进行全文检索功能的实现

    转载请注明出处:http://blog.csdn.net/dongdong9223/article/details/76273859 本文出自[我是干勾鱼的博客] 这里讲一下使用Lucene对doc. ...

  8. 在word中doc与docx的区别是什么(整理)

    在word中doc与docx的区别是什么(整理) docx 是Office2007使用的,是用新的基于XML的压缩文件格式取代了其目前专有的默认文件格式,在传统的文件名扩展名后面添加了字母x(即.do ...

  9. java使用poi读取doc和docx文件(maven自动导入依赖包)

    java使用poi读取doc和docx文件(maven自动导入依赖包) 于是在网上搜寻了一阵之后才发现原来doc文档和excel一样不能用普通的io流的方法来读取,而是也需要用poi,于是进行了一番尝 ...

随机推荐

  1. 【Intel AF 2.1 学习笔记一】AF程序结构

    Intel App Framework(原jqMobi)是用来开发hybrid app的开源免费框架,被intel收编之后发布了最新的2.1版本,最近正在学习.af的所谓程序结构,就是AF网页的架构, ...

  2. C#删除文件直接到回收站,而不是直接删除

    记录下: FileSystem.DeleteDirectory(physicalPath, UIOption.OnlyErrorDialogs, RecycleOption.SendToRecycle ...

  3. [Module] 08 - MVP by Mosby

    From: Mosby MVP使用教程[作者用心] View是消极视图(Passive View), 它尽量不去主动做事, 让Presenter通过抽象方式控制View 例子: 例如Presenter ...

  4. 苹果官方xcodeprojectbuild设置指南

    https://developer.apple.com/library/ios/documentation/DeveloperTools/Reference/XcodeBuildSettingRef/ ...

  5. nyoj 1239 引水project (河南省第八届acm程序设计大赛)

    题目1239 pid=1239" style="color:rgb(55,119,188)">题目信息 pid=1239" style="col ...

  6. js防止表单重复提交

    1.表单 <form id="addForm" onsubmit="getElementById('submitInput').disabled=true;retu ...

  7. Linux 常用文件

    /etc/exports /etc/services /etc/sysctl.conf /etc/logrotate.conf /etc/docker/key.json /etc/docker/dae ...

  8. smarty模板文件书写javascript代码

    在smarty文件里直接写javascript代码时候,造成500错误. javascript代码有很多的{}在同一行,而{}也是smarty引擎解析模板的关键标识符,smarty将对其进行分析,这时 ...

  9. MVC的路由设置【转】

    转,MVC的路由设置. 后端获取路由里面action的参数,函数需要设置相同的参数名称才行. routes.MapRoute( "Default", "{controll ...

  10. Mac 下如何下载、启动和关闭Tomcat 和管理Mac自带的Apache

     Mac 下载.启动和关闭Tomcat 1. 下载Tomcat(地址:tomcat.apache.org),选择适合的版本(这里选择6.0.48),点击“Download”,之后在新页面点击“Core ...