Introducing the Open XML Format External File Converter for 2007 Office System SP2

Summary: Get the details about the interfaces that you need to use to create an Open XML Format External File Converter for the 2007 Microsoft Office system Service Pack 2 (SP2). (16 Printed Pages)

Microsoft Corporation

December 2008

Applies to: 2007 Microsoft Office system SP2, Microsoft Office Excel 2007 SP2, Microsoft Office PowerPoint 2007 SP2, Microsoft Office Word 2007 SP2, Microsoft Office 2010 SP2, Microsoft Excel 2010 SP2, Microsoft PowerPoint 2010 SP2, Microsoft Word 2010 SP2, Microsoft Office 2013 SP1, Microsoft Excel 2013 SP1, Microsoft PowerPoint 2013 SP1, Microsoft Word 2013 SP1

Contents

  • Introduction

  • Overview of Creating External File Converters

  • About the External File Converter Interfaces

  • Using the IConverterInterface Interface

  • Using the IConverterUICallback Interface

  • Using the IConverterPreferences Interface

  • Using the IConverterApplicationPreferences Interface

  • Return Codes

  • ImplementationTips

  • Conclusion

  • Additional Resources

You can download the Sample External Open XML Converter which is a template of Microsoft C++ code files from the following location: Open XML Converter Interface Sample Code.

Introduction

This article provides the technical information necessary to develop external file converters to support importing and exporting content between Office Word 2007 SP2, Microsoft Office Excel 2007 SP2, or Microsoft Office PowerPoint 2007 SP2 and external content sources. The information detailed in this article is supplemented with a sample Open XML Converter template that is available for download.

NoteNote

Microsoft does not offer the template download as part of its product line. Microsoft will not provide technical or any other type of support for the template.

Overview of Creating External File Converters

This section describes the key requirements and components required to create an external file converter.

Open XML Standard and File Converters

To begin developing a converter, you should familiarize yourself with the Open XML standard. For more information, see: Standard ECMA-376: Office Open XML File Formats. The Open XML Formats are based on XML and ZIP technologies, so they are universally accessible. In addition to being open, these formats are robust and interoperable. Any application that supports XML can access and work with data in these formats. Users can also use standard transformations to extract or repurpose the data. In addition, Open XML Formats are an ISO standard as of 2008. For a general overview of the Open XML Formats, see Introducing the Office (2007) Open XML File Formats.

External files are imported into Word 2007 SP2, Excel 2007 SP2, or PowerPoint 2007 SP2 by converting the external file to Open XML Formats. External files are exported from Word 2007 SP2, Excel 2007 SP2, or PowerPoint by converting Open XML Formats to external files. The success of either the import or export conversion depends upon the accurate generation and interpretation of Open XML Formats by the converter. Carefully following these specifications avoids problems during conversion development and testing.

COM and File Converters

In addition to Open XML Formats, you should familiarize yourself with Component Object Model (COM) technology. For more information about this technology see the following sites:

Word 2007 SP2, Excel 2007 SP2, and PowerPoint 2007 SP2 use COM as the underlying architecture to communicate with Open XML Format converters. Each unique converter is identified by class IDs (CLSIDs), which are essentially Globally Unique Identifiers (GUIDs). The converters use several interfaces to import and export foreign file formats to and from applications. This document outlines these Open XML Format converter interfaces.

The Open XML Format converter interfaces takes advantage of COM’s QueryInterface to evolve over time. QueryInterface allows the Open XML Format converter interfaces to make more interfaces available to new clients while retaining complete binary compatibility with existing client code.

In other words, revising the Open XML Format converter interfaces by adding new functionality does not require any recompilation of existing clients. This guarantees backward compatibility as these converter interfaces are upgraded.

Open XML Format converters for Word 2007 SP2, Excel 2007 SP2, or PowerPoint 2007 SP2 are implemented as out-of-process COM servers. Out-of-process converters have the benefit of running in their own process space, which means issues or crashes within converters do not affect the application process space. In addition, out-of-process 32-bit converters can function on 64-bit operating systems in Microsoft Windows on Windows 64-bit (WoW64) mode without the need for converters to be compiled in 64-bit.

Application and Version Compatibility

External file converters based on Open XML Formats are compatible with 2007 Office system SP2.

Adding Converter Configuration Settings in Windows Registry

Converters must include appropriate Windows registry information before they can be used by the applications. Information about converters accessible by Word 2007 SP2, Excel 2007 SP2, or PowerPoint 2007 SP2 is stored in subkeys in the registry. The following table includes application specific subkey registry paths.

Caution noteCaution

Modify the registry at your own risk. If you corrupt the registry, you might have to reinstall the operating system to fix the problem. Microsoft cannot guarantee that registry problems can be solved.

Table 1. Converter information for program subkeys

Application

Subkey

Excel

HKEY_LOCAL_MACHINE \Software\Microsoft\Office\appversion\Excel\Text Converters\OOXML Converters\

PowerPoint

HKEY_LOCAL_MACHINE \Software\Microsoft\Office\appversion\PowerPoint\Presentation Converters\OOXML Converters

Word

HKEY_LOCAL_MACHINE \Software\Microsoft\Office\appversion\Word\Text Converters\OOXML Converters

In the table, appversion is version-specific by application. For example, applications in 2007 Office use 12.0 for the appversion.

NoteNote

If installing a converter on a 64-bit operating system, make sure to edit the Office node under the Wow6432 node in the registry.

Under the OOXML Converters node, information for the import converter is found under the subkey Import and for export converters is found under the Export subkey.

Finally, under Import or Export, as appropriate, is a unique key for each conversion, called its class name. A single converter may implement more than one conversion; for example, it may both import and export, and it may import or export multiple subtly different file formats. Therefore, more than one class name may be associated with a particular converter. Class names are not seen by the user, and so, never need to be localized.

Under each class name are the particular registry values for that conversion. The following values (all are strings, or REG_SZ values in registry terms) are required. The registry contains the information shown in Table 2. When searching for a converter, Word 2007 SP2, Excel 2007 SP2, or PowerPoint 2007 SP2 search for this registry information.

Table 2. Converter information stored in the registry

Value Name

Value

Name

Description string seen by the user in the Save dialog and Open dialog for Word 2007 SP2, Excel 2007 SP2, and PowerPoint 2007 SP2 depending on whether the converter is an import, export, or a converter that can handle both import and export. Because this string is seen by users, it should be localized in the appropriate language versions of a converter.

CLSID

A class ID of the converter that is used in CoCreateInstance to start the converter.

Extensions

Space-separated list of file name extensions (i.e. “xdoc xppt”). These extensions specify files that are likely to be of the appropriate external file type for a conversion.

The following is an example of a set of registry entries that reads and writes the Testing 1.0 file and Testing 1.1 file as a Word 2007 SP2 Open XML Format converter. When exporting, it is important for the users to be able to select a specific minor version to save to, and so there are separate entries for 1.0 and 1.1. When importing, the converter can handle files of both minor version types, so only one entry is required.

HKEY_LOCAL_MACHINE\Software\Microsoft\Office\12.0\Word\
 Text Converters\OOXML Converters
  Export\
   Testing10\
    Extensions “xdoc”
    Name   “Testing 1.0”
    Clsid  “{FB9502AC-5DA4-4756-BF67-1C4086B70C62}”
   Testing11\
    Extensions “xdoc”
    Name   “Testing 1.1”
    Clsid  “{FB9502AC-5DA4-4756-BF67-1C4086B70C62}”
  Import\
   Testing\
    Extensions “xdoc”
    Name   “Testing 1.x”
   Clsid  “{FB9502AC-5DA4-4756-BF67-1C4086B70C62}”

Setting a Converter as the Default Converter for a File Name Extension

You can install and register more than one converter for a particular extension for import. These different converters show up in the Open dialog of the File menu for the applicable application: Word 2007 SP2, Excel 2007 SP2, or PowerPoint 2007 SP2. Typically there are two mechanisms for users to open a file by using a converter in the Office applications:

  • A user can explicitly select a given converter by choosing the converter name in the filter list of the Open dialog of the File menu.

  • A user can open a file through any of the various file open mechanisms (such as by using a command line), which does not require using the application user interface (UI) to select the converter name.

To ensure that one converter is preferred over another converter for the same external file name extension when opened without using the UI, you can register converters as the default converter for a particular extension. When you specify a converter to be the default converter for a particular extension, the application prefers that converter whenever the file with that given extension is opened without using the UI.

You can only specify one converter as the default converter for a given file name extension. To set a converter as the default, modify the subkey Defaults under the following subkeys based on the application as follows:

  • Word: Text Converters

  • Excel: Text Converters

  • PowerPoint : HKEY_CURRENT_USER \Software\Microsoft\Office\appversion\PowerPoint\Presentation Converters\OOXML Converters

    The Defaults subkey must have the following information to make a particular converter the default converter for a given extension:

  • Value Name, Value

    • Value Name is an extension, such as xdoc.

    • Value is the class name of the converter that is the default converter for that extension.

Populating the Defaults subkey is optional for converters. If you do not specify a converter as a default for a given extension then the application shall process the list of converters in a manner defined by the application.

The following is an example registry entry for specifying a specific converter as the default converter for files with an extension test for Word 2007 SP2.

HKEY_LOCAL_MACHINE\Software\Microsoft\Office\12.0\Word\Text Converters
  Defaults\
   “xdoc”  “Testing10”

Overriding the Supported File Format

In addition to allowing converters to override external file formats, the applications allow converters to override OpenDocument Format-related formats (such as .odt). For example, if you specify a converter to be the default converter for .odt, Word 2007 SP2 invokes the specified converter whenever a user tries to open an .odt file from the Windows Shell instead of going through the native load path for Word 2007 SP2.

About the External File Converter Interfaces

Open XML Format converters are implemented as COM servers. The following sections define the interfaces between the applications and the converters. These interfaces are shared across Word 2007 SP2, Excel 2007 SP2 and PowerPoint SP2.

IConverter Interface

The primary interface is the IConverter interface, and it is responsible for the core functionality of the converter. This interface is made up of the following entry points as shown in Table 3.

Table 3. IConverter interface entry points

Entry Point

Description

Status

HrInitConverter

Initialize the converter. Parse high-level options from calling application and provide converter’s high-level options to calling application.

Required

UninitConverter

Terminate the converter.

Required

HrImport

Read external file and translate to an Open XML Format file.

Required /Optional1

HrExport

Read an Open XML Format file and translate to external file.

Required /Optional2

HrGetErrorString

Fetch a textual representation of a converter error code.

Optional

HrGetFormat

Read file path and provide information as to which file format the converter can interact with.

Required

1 - Only required if HrExport is not implemented.

2 - Only required if HrImport is not implemented.

IConverterUICallback Interface

This interface is responsible for the entry points specific to the UI that will display in the application. It is comprised of the following entry points as shown in Table 4.

Table 4. IConverterUICallback interface entry points

Entry Point

Description

Status

HrReportProgress

Allows the converter to display progress with respect to conversion.

Optional

MessageBox

Provides functionality analogous to the SystemMessageBox functionality.

Optional

HrInputBox

Displays a prompt in a dialog box, waits for the user to input text or click a button, and returns the contents of the text box.

Optional

IConverterPreferences Interface

This interface is responsible for communicating a converter’s preferences to the host application. The application calls the converter with a list of the application’s preferences and the converter returns a list of its own preferences. Having both sets of preferences, the application and the converter can deduce the correct behavior for this particular conversion. Table 5 details the entry points for this interface.

Table 5. Entry points for the IConverterPreference interface

Entry Point

Description

Status

HrGetMacroEnabled

Allows converters to tell the application whether to use macro-enabled Open XML Format as the intermediate file format during conversion.

Optional

HrCheckFormat

Allows converters to ask the application to parse and respect the Open XML Format as a specific Open XML implementation.

Optional

HrGetLossySave

Allows converters to tell the application that there is loss of data in the file after conversion.

Optional

IConverterApplicationPreferences Interface

This interface is responsible for communicating an application’s preferences to the converter. Using this interface an application can indicate to the converter a variety of preferences and data. Table 6 details the entry points for this interface.

Entry Point

Description

Status

HrGetLCID

Allows converters to ask the application which language to use for displaying in the UI.

Optional

HrGetHWND

Allows converters to get a handle to the application’s window.

Optional

HrGetApplication

Allows converters to determine which application it is communicating with.

Optional

HrCheckFormat

Allows applications to indicate to the converters to parse and respect the Open XML Format as a specific Open XML implementation.

Optional

Using the IConverterInterface Interface

The following sections detail the supported members of this interface. The IConverterInterface contains the shell of methods where you can add your own code. By doing this, the converter converts the document file format into the Open XML format that the Office application recognizes.

Initializing the Converter (HrInitConverter)

An application calls HrInitConverter before any other converter entry point to permit the converter to perform any necessary global initialization.

HRESULT HrInitConverter(IConverterApplicationPreferences * , IConverterPreferences ** , IConverterUICallback *);

Parameters:

  • IConverterApplicationPreferences *: A pointer to the host application’s list of preferences.

  • IConverterPreferences **: The converter should fill in a pointer to its list of preferences to which it wants the host application to abide.

  • IConverterUICallback *: A pointer to application-provided UI entry points that the converter can use.

Results:

  • HRESULT

    • For details about how to handle the return result, see Return Codes.

Terminating the Converter (UninitConverter)

An application calls UninitConverter after a conversion operation is finished to permit the converter to perform any necessary global finalization.

void UninitConverter(IConverterUICallback *);

Parameters:

  • IConverterUICallback *: A pointer to the application-provided UI entry points that the converter can use.

Converting an External File to Open XML (HrImport)

External files are imported to the applications through conversion of the external file to the Open XML Format by calling HrImport.

HRESULT HrImport(BSTR bstrSourcePath, BSTR bstrDestPath, IConverterApplicationPreferences * , IConverterPreferences ** , IConverterUICallback *);

Parameters:

  • BSTR bstrSourcePath: The source path to which the foreign file can be located.

  • BSTR bstrDestPath: The host application provides a file destination to which the converter should write out the Open XML Format file.

  • IConverterApplicationPreferences *: A pointer to the host application’s list of preferences.

  • IConverterPreferences **: The converter should fill in a pointer to its list of preferences to which it wants the host application to abide.

  • IConverterUICallback *: A pointer to the application-provided UI entry points that the converter can use.

Results:

  • HRESULT

    • For details about how to handle the return result, see Return Codes.

Converting Open XML to an External File (HrExport)

Open XML Format files are exported from the applications through conversion of the Open XML Format to the external file format by calling HrExport.

HRESULT HrExport(BSTR bstrSourcePath, BSTR bstrDestPath, BSTR bstrClass , IConverterApplicationPreferences * , IConverterPreferences ** , IConverterUICallback *);

Parameters:

  • BSTR bstrSourcePath: The source file path in which the Open XML Format file can be located.

  • BSTR bstrDestPath: The host application provides a destination path to which the converter should save the foreign file.

  • BSTR bstrClass: Specifies the type of file format being saved.

  • IConverterApplicationPreferences *: A pointer to the host application’s list of preferences.

  • IConverterPreferences **: The converter should fill in a pointer to its list of preferences to which it wants the host application to abide.

  • IConverterUICallback *: A pointer to application-provided UI entry points that the converter can use.

Result:

  • HRESULT

    • For details about how to handle the return result, see Return Codes.

Get File Type (HrGetFormat)

The host application gives the converter a chance to confirm that it can load an external file format by calling HrGetFormat.

HRESULT HrGetFormat(BSTR bstrPath, BSTR* pbstrClass, IConverterApplicationPreferences * , IConverterPreferences ** , IConverterUICallback *);

Parameters:

  • BSTR bstrPath: The path to the foreign file.

  • BSTR* pbstrClass: Specifies the type of file format the converter understands.

  • IConverterApplicationPreferences *: A pointer to the host application’s list of preferences.

  • IConverterPreferences **: The converter should fill in a pointer to its list of preferences to which it wants the host application to abide.

  • IConverterUICallback *: A pointer to application-provided UI entry points that the converter can use.

Result:

  • HRESULT

    • S_OK if the converter can read the file type.

      • If returning S_OK, fill in the class name in wzClass.
    • S_FALSE if the converter cannot read the file type.

    • For details about how to handle other return results, see Return Codes.

The converter should open the file, scan it as necessary to determine if the converter understands the data in the file, and close the file. This method must return S_OK if the converter recognizes the file, S_FALSE if the file is of an unknown type, or if some error occurs. HRESULT if the operation fails.

Error Reporting (HrGetErrorString)

A converter may define and return additional error codes of its own. An application cannot be expected to know the meaning of any such codes, and should report some generic error message. However, if the converter supplies the following optional application programming interface (API), the calling application may choose to call it to obtain a textual representation of any return value and use this to provide better diagnostics to the user.

HRESULT HrGetErrorString(long hrErr, BSTR* pbstrErrorMsg, IConverterApplicationPreferences *);

Parameters:

  • Long hrErr: The error code for which a message needs to be generated.

  • BSTR* pbstrErrorMsg: The string buffer the error message is to be placed in.

  • IConverterApplicationPreferences *: A pointer to the host application’s list of preferences.

    Result:

    • HRESULT

      • For details about how to handle the return result, see Return Codes.

Using the IConverterUICallback Interface

Converter Progress (HrReportProgress)

A converter may wish to report progress for the conversion process to allow for cancellation of the operation. The following method on IConverterUICallback allows the converter to report progress to the host application. The converter calls the method every time it wishes to give a progress update. If the host application cancels the conversion, this method returns E_ABORT, which indicates to the converter to abort the operation.

HRESULT HrReportProgress(unsigned int nPercentComplete);

Parameters:

  • unsigned int nPercentComplete: Specifies the current completeness of the operation in terms of a percentage.

Result:

  • HRESULT

    • E_ABORT: Cancel conversion.

    • For details about how to handle other return results, see Return Codes.

Message Box (HrMessageBox)

You can have A converter show simple UI message boxes to the host application.

HRESULT HrMessageBox(BSTR bstrText, BSTR bstrCaption, unsigned int uType, int* pidResult);

Parameters:

  • BSTR bstrText: The text to be used for the message box.

  • BSTR bstrCaption: The title of the message box window.

  • unsigned int uType: Message box flags as defined by MessageBox Function.

  • int* pidResult: Defined by MessageBox Function.

Result:

  • For details about how to handle other return results, see Return Codes.

Input Box (HrInputBox)

You can have a converter show an input dialog box in the host application.

HRESULT HrInputBox(BSTR bstrText, BSTR bstrCaption, BSTR* pbstrInput, BOOL fPassword);

Parameters:

  • BSTR bstrText: The text to be used for the message box.

  • BSTR bstrCaption: The title of the message box window.

  • BSTR* pbstrInput: The buffer to be filled with the user input.

  • BOOL fPassword: Specifies whether to use a password input box.

Result:

  • HRESULT

    • For details about how to handle other return results, see Return Codes.

Using the IConverterPreferences Interface

The following sections detail the supported members of this interface.

NoteNote

If the preferences list needs to be expanded in future versions, you can accomplish this by running QueryInterfacing against the preference pointers.

Use Macro-Enabled Open XML Formats (HrGetMacroEnabled)

This member allows converters to ask the application whether to use macro-enabled Open XML Formats as the intermediate file format. Not specifying this preference implies that the macro-free files shall be used as the intermediate file format during conversion.

NoteNote

This preference is only functional with Word 2007 SP2 and Excel 2007 SP2. This preference is only valid in the context of HrExport.

This member has only one parameter:

  • BOOL* pfMacroEnabled

    • Default: false

    • Value false: Do not use macro enabled Open XML Formats.

    • Value true: Use macro enabled Open XML Formats.

Result:

  • HRESULT

    • For details about how to handle other return results, see Return Codes.

Open XML Format Parse Hint (HrCheckFormat)

This member allows converters to indicate to the application to parse and respect the Open XML Format as the specified Open XML implementation, where implementation can be Ecma-376, ISO-strict, or ISO-transitional.

NoteNote

This preference is only valid in the context of HrImport.

This member has only one parameter:

  • int* pfmt

    • The converter prefers the application to parse the file as the format specified by the int value where fmt can have the following values:

      • 1 – WordprocessingML ECMA376 macro-free

      • 2 – WordprocessingML ECMA376 + macros

      • 3 – WordprocessingML ISO Transitional macro-free

      • 4 – WordprocessingML ISO Transitional + macros

      • 5 – WordprocessingML ISO Strict macro-free

      • 6 – WordprocessingML ISO Strict + macros

      • 7 – SpreadsheetML ECMA376 macro-free

      • 8 – SpreadsheetML ECMA376 + macros

      • 9 – SpreadsheetML ISO Transitional macro-free

      • 10 – SpreadsheetML ISO Transitional + macros

      • 11 – SpreadsheetML ISO Strict macro-free

      • 12 – SpreadsheetML ISO Strict + macros

      • 13 – PresentationML ECMA376 macro-free

      • 14 – PresentationML ECMA376 + macros

      • 15 – PresentationML ISO Transitional macro-free

      • 16 – PresentationML ISO Transitional + macros

      • 17 – PresentationML ISO Strict macro-free

      • 18 – PresentationML ISO Strict + macros

Result:

  • HRESULT

    • For details about how to handle other return results, see Return Codes.

If a converter specifies a format value that is not understood by the application, then the application shall process the Open XML Format in an application-specific manner.

Specifying Files as Lossy (HrGetLossySave)

This member allows converters to tell the application that there is loss of data in the file after conversion.

NoteNote

This preference is only functional with PowerPoint 2007 SP2.

This member has only one parameter:

  • BOOL*fLossySave

    • Default: false

    • Value false: There is no data loss in the file after conversion.

    • Value true: There is data loss in the file after conversion.

Result:

  • HRESULT

    • For details about how to handle other return results, see Return Codes.

Using the IConverterApplicationPreferences Interface

The following sections detail the supported members of this interface.

NoteNote

If the preferences list needs to be expanded in future versions, you can accomplish this by running QueryInterfacing against the preference pointers.

UI Language (HrGetLcid)

This member allows the application to indicate to the converter the installation language of the application. This information is useful to the converter if it needs to show language-specific dialogs or messages. For a list of LCID values, see Locale ID (LCID) Chart.

This member has only one parameter:

  • DWORD* plcid

    • Maps to the installation language of the application.

Result:

  • HRESULT

    • For details about how to handle other return results, see Return Codes.

UI Parenting (HrGetHwnd)

This member allows the application to give the converter a pointer to the application’s window handle. With this handle a converter can successfully send converter-specific UI to the application.

This member has only one parameter:

  • long* phwnd

    • hwnd to use for the parenting application UI.

Result:

  • HRESULT

    • For details about how to handle other return results, see Return Codes.

Application Disambiguation (HrGetApplication)

If a converter chooses to support multiple applications then there is an ambiguity problem during loading and saving in which the converter may not know which application it is communicating with. This member allows converters to determine the application that it is communicating with to differentiate between applications.

This member has only one parameter:

  • BSTR* pbstrApplication

    • A string that states the application to which the converter is communicating.

      • Microsoft Office Word

      • Microsoft Office Excel

      • Microsoft Office PowerPoint

Result:

  • HRESULT

    • For details about how to handle other return results, see Return Codes.

Open XML Format Parse Hint (HrCheckFormat)

Similarly to converter preferences, the application can use this member to indicate to the converter exactly which Open XML Format it has given back to the converter during HrExport.

NoteNote

This preference is only valid in the context of HrExport.

This member has only one parameter:

  • int* pfmt

    • Converter prefers the application to parse the file as the format specified by the int value where fmt can have the following values:

      • 1 – WordprocessingML ECMA376 macro-free

      • 2 – WordprocessingML ECMA376 + macros

      • 3 – WordprocessingML ISO Transitional macro-free

      • 4 – WordprocessingML ISO Transitional + macros

      • 5 – WordprocessingML ISO Strict macro-free

      • 6 – WordprocessingML ISO Strict + macros

      • 7 – SpreadsheetML ECMA376 macro-free

      • 8 – SpreadsheetML ECMA376 + macros

      • 9 – SpreadsheetML ISO Transitional macro-free

      • 10 – SpreadsheetML ISO Transitional + macros

      • 11 – SpreadsheetML ISO Strict macro-free

      • 12 – SpreadsheetML ISO Strict + fmacros

      • 13 – PresentationML ECMA376 macro-free

      • 14 – PresentationML ECMA376 + macros

      • 15 – PresentationML ISO Transitional macro-free

      • 16 – PresentationML ISO Transitional + macros

      • 17 – PresentationML ISO Strict macro-free

      • 18 – PresentationML ISO Strict + macros

Result:

  • HRESULT

    • For details about how to handle other return results, see Return Codes.

Return Codes

The APIs detailed herein return standard HRESULT return codes, as defined at HRESULT. It is recommended that you use the SUCCEEDED and FAILED macros described at Using Macros for Error Handling to determine the success of application-side operations.

ImplementationTips

This section describes some additional tips to consider when creating an Open XML Format External File Converter.

  • Excel 2007 SP2 does not support importing macros by using the converter interface. Excel 2007 SP2 does, however, allow macros to be exported by using the converter interface.

  • PowerPoint 2007 SP2 does not support importing or exporting macros by using the converter interface.

  • HrGetLossySave is only respected by PowerPoint 2007 SP2.

  • To ease with testing converters, it is recommended to capture break points at the time converters are started. By enabling the necessary debugging registry flag you are able to debug and step through the converter every time it is started. Perform the following steps to enable this flag:

    1. Install a debugger (for information about debugging tools for Windows, see the following article: Debugging Tools for Windows: Introduction.

    2. Run regedit.exe.

    3. Navigate to HKLM\Software\Microsoft\Windows NT\CurrentVersion\Image File Execution Options and do the following:

      • Create a key that is the name of the converter file (that is, the name of the executable)

      • Add a REG_SZ value, with Name: Debugger, and Value: name of debuggerconverter filename (for example, c:\debuggers\ntsd.exe testconv.exe).

  • For more information on other debugging options (as well as the UI to perform the previous steps) see Gflags.

Conclusion

Open XML format files are based on the familiar ZIP and XML technologies. You can create them independently of any proprietary application. This makes creating a utility for converting files from other formats to those used in 2007 Microsoft Office applications relatively straight-forward. By using the information described in this article and the accompanying code sample, you should be well on your way to creating a file converter for your own applications.

Additional Resources

The following is a list of additional resources.