原文链接 :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. 【VirtualBox】ubuntu虚拟机与windows设置共享文件夹

    第一步:配置 http://blog.csdn.net/a962804835/article/details/72820355 第二步:解决ubuntu下共享文件夹无访问权限的问题 http://bl ...

  2. 【spark】jieba + wordcount

    import sys reload(sys) sys.setdefaultencoding('utf-8') from os import path import jieba from pyspark ...

  3. Lua中用Split函数分割字符串

    function Split(szFullString, szSeparator) local nFindStartIndex = local nSplitIndex = local nSplitAr ...

  4. MathType如何编辑大三角形符号

    MathType中包含的符号超过1000多个,可以满足我们很多学科的使用,尤其是数学中,涉及到很多的符号,常见的就是代数.几何这两大类,当然还有集合之类的符号使用也比较多.我们在用MathType编辑 ...

  5. python2和3的区别,怎么样做到轻松切换2和3

    以下是菜鸟教程列举的.这些零散的改变需要注意. 下面这些东西可能平时的程序根本没用到,或者稍加注意就可以了.但2和3最主要的区别是,掌握编码. 编码在所有程序中无处不在,处理不好,要么乱码,要么编码解 ...

  6. Linq To EF (添加记录后获取添加的自增ID和叫“ID”的列不是自增列不让插入的问题)

    1:添加记录后,如何获取新添加的ID的值 比如,一个实体 TestEntity   对应一个表TestEntity(ID主键自增,Name,age),使用linq to ef   添加一条记录后,如何 ...

  7. Android开发真机测试方法 (转)

    转自:http://blog.csdn.net/china_lzn/article/details/7461963 Android的AVD无比的慢,无语啊,程序编的再好,都无法体验到流畅的感觉,索性, ...

  8. LHC大神问的矩阵转置问题

    数学中线性代数中提到的矩阵转置,其实在我们的业务场景中也有需要的地方,比如LHC大神问到的这个问题 那么如何进行行列转换呢? 代码如下: <?php $array=array( '部门1'=&g ...

  9. ios开发之--实现TextView提示文字并且输入字数限制

    实现字数控制和限制,并展示当前输入的字符串长度,以及按钮的点击状态,代码如下: 1,设置代理 @interface FKViewController ()<UITextViewDelegate& ...

  10. RFC文件

    RFC(Request For Comments)-意即“请求评议”,包含了关于Internet的几乎所有重要的文字资料.如果你想成为网络方面的专家,那么RFC无疑是最重要也是最经常需要用到的资料之一 ...