Udostępnij za pośrednictwem


How to: Add Custom XML Parts to Documents Without Starting Microsoft Office

You can add a custom XML part to a document without starting Microsoft Office Excel, Microsoft Office PowerPoint, or Microsoft Office Word. This is useful if you want to store XML data in a document on a computer that does not have Microsoft Office installed, such as a server. For more information, see Custom XML Parts Overview.

Applies to: The information in this topic applies to the following applications: Excel 2007 and Excel 2010; PowerPoint 2007 and PowerPoint 2010; Word 2007 and Word 2010. For more information, see Features Available by Office Application and Project Type.

The document must be in one of the Open XML Formats, such as .docx, .xlsx, or .pptx. You cannot access custom XML parts in the binary file formats without starting the Microsoft Office application.

To add a custom XML part to a document without starting Microsoft Office

  • Use classes in the Open XML SDK. These classes are designed to provide access to Open XML content that is specific to Office documents. For example, to add a custom XML part to an Excel workbook, you use the AddNewPart<T> method of a WorkbookPart object. For more information, see Open XML SDK 2.0.

See Also

Tasks

How to: Add Custom XML Parts to Document-Level Customizations

How to: Add Custom XML Parts to Documents by Using Application-Level Add-Ins

Concepts

Custom XML Parts Overview

Change History

Date

History

Reason

April 2011

Removed procedural content as there were issues with the code example. Instead, provided a link to the Open XML SDK 2.0 content. That content provides the most recent examples of how to add custom XML parts to documents without starting Microsoft Office.

Content bug fix.