Megosztás a következőn keresztül:


Convert binary Office files by using the Office File Converter (OFC) and Version Extraction Tool (VET)

 

Applies to: Office 2010

Topic Last Modified: 2011-07-25

Banner stating end of support date for Office 2010 with link to more info

The Office Migration Planning Manager (OMPM) includes two tools to help you manage binary Office files during a migration to Microsoft Office 2010. You can use the Office File Converter (OFC) to convert binary files in bulk to the OpenXML format that is used by Office 2010 and the 2007 Office system. Use the Version Extraction Tool (VET) to extract multiple saved versions of a single Word 97–2003 document to individual files. Both tools are typically used together with scan results that are generated by OMPM.

Convert files in bulk by using OFC

Before using OFC, review the following usage guidelines.

  • The Microsoft Office Compatibility Pack must be installed on the computers that contain the files that you want to convert. For more information, see Microsoft Office Compatibility Pack for Word, Excel, and PowerPoint File Formats (https://go.microsoft.com/fwlink/p/?LinkID=77512).

  • The OFC converts binary .doc files to the .docx file format that is used by Word 2007. As a result, when a user opens a converted .docx file in Word 2010, the file is opened in Word 2007 compatibility mode. The OFC does not support conversion of .doc files to the Word 2010 .docx format. Users can convert the files individually to the Word 2010 .docx format by clicking the File tab, and then clicking Convert.

  • The OFC can convert to a maximum depth of 10 folders. For example, DestinationPathTemplate=I:\Converted\*1\*2\*3\*4\*5\*6\*7\*8\*9\ works correctly. However, DestinationPathTemplate=I:\Converted\*1\*2\*3\*4\*5\*6\*7\*8\*9\*10\ does not work. To work around this issue, use commands such as net use or subst to shorten the path.

Before running the Office File Converter, first edit the ofc.ini file to set the appropriate parameters.

To convert files

  1. At a command prompt, navigate to the folder where OFC is installed.

  2. Type the following command:

    ofc <ofc.ini>

The parameter for this command is as follows.

Parameter Description

ofc.ini

The location of the ofc.ini file. If no path is specified, OFC looks in the same directory as the executable. Optional.

Note

If you set FileListFolder and FoldersToConvert to the same set of files, the set of files will be converted twice.

Ofc.ini Settings

The following table shows the settings and values in ofc.ini.

Setting Description Possible Values If value is missing If value is not valid

[Run]

Section lists unique ID and description of this conversion. Required.

Conversion stops with error message.

Error: [Run] section heading invalid or missing in OFC.INI.

RunID

Tracking number for the current Conversion. Use this to group Conversions from different computers in the Reporting Tool. Required.

Must be numeric

Conversion stops with error message.

Error: Invalid or missing RunID value in OFC.INI.

Description

Text that is used to describe the current conversion run. Optional.

Free-form text, truncated to 255 characters

Ignore.

Not applicable.

LogDestinationPath

Location for the log file that is generated when the FileList setting is used. Required.

This setting does not generate log files that capture the text that is displayed in the Command Prompt window during conversion. Use the ">" command (for example, ofc.exe > C:\Log.txt) to save any command shell output to a text file.

Physical or mapped drive or UNC. For example: c:\Conversion\logs

\\server\vba\logs

Environment variables are also supported.

Conversion stops with error message.

Error: Invalid or missing ‘LogDestinationPath’ value in OFC.INI.

[ConversionOptions]

Section heading for a part of the .INI file that deals with conversion options. Required, unless there are no conversion options that are specified in the .ini file.

Conversion stops with error message.

Error: [ConversionOptions] section heading invalid or missing in OFC.INI.

DoNotCab

Enables users to disable creating CAB files of log files. Optional.

Valid values are

1 – disables creating CAB files of log files

0 – enables CAB’ing of log files

Conversion stops with error message.

Error: Invalid or missing DoNotCab value in OFC.INI.

MacroControl

Determines if the converter includes any macro projects during conversion. A setting of 1 causes the OFC to produce macro-free OpenXML document formats (such as .docx, xlsx, pptx). Macro/VBA code in the original documents will not be migrated. Optional.

Valid values are

1 – disregard VBA on conversion

0 – match macro state of source document.

Defaults to 0.

Error: Invalid ‘MacroControl’ value in OFC.INI.

[FoldersToConvert]

Section lists directories to convert for stand-alone operation. FileList will be ignored. Optional.

List of folders.

Ignored if input file passed.

Error: [FoldersToConvert] section invalid in OFC.INI.

ConvertSubfolders

If folders are specified, a setting of 1 causes the OFC to traverse subfolders, converting all Word, XL, & PPT documents. Optional.

0 or 1

Defaults to 0.

Error: Invalid ‘ConvertSubfolders’ value in OFC.INI.

[ConversionInfo]

Section lists input file and destination information. Required.

[ConvertedFolders]

Conversion stops with error message.

Error: [ConversionInfo] section heading invalid or missing in OFC.INI.

FileList

Path to FileList. Optional.

Error if not present and [FoldersToConvert] empty.

SourcePathTemplate

A sequence of *\ that determines how many directories from the source path will be captured. You can use wildcard characters so that an asterisk (*) represents a single segment of the path. Optional.

When you run SourcePathTemplate locally, it includes network path infomation. For example, a file at C:\Documents\file.doc is specified as *1\=machinename, *2\=C:\, *3\=Documents, and *4\=file.doc

Any physical or mapped drive or UNC. * or ‘.’

Error: Invalid ‘SourcePathRoot’ value in OFC.INI.

DestinationPathTemplate

Used to determine location of converted file. You can use wildcard characters so that an asterisk (*) plus a number represents a single segment of the path. See the examples below this table. Optional.

Any physical or mapped drive or UNC. * or ‘.’

Error: Invalid ‘DestinationPathRoot’ value in OFC.INI.

The following examples show how you can use the SourcePathTemplate and DestinationPathTemplate settings.

Example 1

In this example, the source files are located in \\userfiles\<user name>\docs\ and the desired output is to \\newserver\docs\<user name>\.

To achieve this result, the SourcePathTemplate and DestinationPathTemplate settings should appear as follows:

SourcePathTemplate = *\*\*\
DestinationPathTemplate = \\newserver\*3\*2

In this case, DestinationPathTemplate assigns a number for each directory segment that is represented by an asterisk in SourcePathTemplate, so that:

*1 = userfiles

*2 = <user name>

*3 = docs

The following table shows sample source file locations and the resulting locations for converted files that have the settings that are shown above.

Source Destination
\\userfiles\Cliff\docs\notes.doc
\\newserver\docs\Cliff\notes.docx
\\userfiles\Bob\docs\Personal\Rept1.doc
\\newserver\docs\Bob\Personal\Rept1.docx
\\userfiles\James\docs\New Folder\Schedule.doc
\\newserver\docs\James\New Folder\Schedule.docx

Example 2

In this example, the source files are located in the My Documents folders on users' local computers. The UNC path is \\<computer name>\<drive letter>$\Documents and Settings\<user name>\My Documents\. The desired output is to \\DocServer\docs\<user name>\.

To achieve this result, configure the SourcePathTemplate and DestinationPathTemplate settings as follows:

SourcePathTemplate = *\*\*\*\*\
DestinationPathTemplate = \\DocServer\*4\

In this case, DestinationPathTemplate assigns a number for each directory segment that is represented by an asterisk in SourcePathTemplate so that:

*1 = <computer name> (for example, DESKTOP3)

*2 = <drive letter>$ (for example, c$)

*3 = Documents and Settings

*4 = <user name> (for example, bobsmith)

*5 = My Documents

The following table shows sample source file locations and the resulting locations for converted files that have the above settings.

Source Destination
\\DESKTOP3\c$\Documents and Settings\bobsmith\My Documents\Plans.doc
\\DocServer\bobsmith\Plans.docx
LPTP4\d$\Documents and Settings\James\My Documents\Reports\q1.xls
\\DocServer\James\Reports\q1.xlsx

Use VET for extracting versions of Word files

You can use the Version Extraction Tool (VET) included in OMPM to extract versions of files from Word files that were created in Office 2000, Office XP, and Office 2003 that contain versioning. By using this tool, you can use the list of files generated by the OMPM reporting utility.

To extract versions from Word files

  1. At a command prompt, navigate to the folder where VET is installed.

  2. Type:

    vet <OMPM file list directory> <output directory>

The parameters for this command are as follows:

Parameter Description

OMPM file list directory

Location of the file list that is generated by OMPM. Required.

output directory

The directory to which you want to copy all of the versions of the Word files. Required.

For example, to use file lists contained in the c:\ompm\filelists directory and extract versions to the c:\ompm\output directory, you would type:

vet c:\ompm\filelists c:\ompm\output

VET error messages

The following table show the error messages that VET writes both to the log and to the action file.

Error Message Description

IssueID 9090: Could not open document <document name>.

The original document that was flagged as having versions did not open in Word.

IssueID 9096: Could not get the number of versions for document <document name>.

VET was unable to query the document for the number of versions in the named document. The object model command Versions.Count failed.

IssueID 9091: Could not delete existing version folder <folder path>.

An existing versions folder exists for a specific file, and VET was unable to delete it and could not create a new folder for the new version files.

IssueID 9092: Could not create directory to hold versions <directory name>.

VET was unable to create a directory to hold the versions extracted for a specific document.

IssueID 9093: Failed to access version item.

VET was unable to access the version using the Word object model command Versions.Item(i).

IssueID 9094: Failed to open version <version number> from <file name>.

VET was unable to open the version that was specified using the Word object model command Versions.Item(i).Open().

IssueID 9095: Failed to save version <version number> from <file name> to <version folder name>.

VET was unable to save the specified version from the document to the versions folder.