XpsMailMerge

The XpsMailMerge program demonstrates how to use named fields in an XPS document to merge data into the document programmatically.

This topic contains the following sections:

Description

In this sample, text and graphical data is merged into the template document.

The XpsMailMerge sample program opens an existing XPS document that is used as a template. The template document contains named elements whose contents will be replaced with merged data. The program then saves the modified document after the data has been merged.

Requirements

ProductVersion
Microsoft WindowsWindows 7
Windows SDKWindows 7 Platform Software Development Kit (SDK)
Microsoft Visual StudioVisual Studio 2008 or later

 

Downloading the Sample

LocationPath/URL
Code Galleryhttp://go.microsoft.com/fwlink/p/?linkid=166455

 

Building the Sample

To build the sample by using Visual Studio:

  1. Open Windows Explorer and navigate to the directory that contains the sample code files.

  2. Open the XpsMailMerge.sln file in Visual Studio by double-clicking the XpsMailMerge.sln file icon.

    Note  The solution file in this sample is compatible with Visual Studio 2008 and later versions of Visual Studio.

  3. In the Build menu, select Build Solution.

The application will be built in the default \Debug or \Release directory.

Running the Sample

To run the sample after it has been built:

  1. Use Windows Explorer or the Command Prompt window to navigate to the directory that contains the new executable file.
  2. Run the program, either from the Command Prompt window or from Windows Explorer.
    • In the Command Prompt window, type XpsMailMerge.exe.
    • In Windows Explorer, double-click the XpsMailMerge.exe icon.

Additional Information

XpsMailMerge.exe creates a single-page XPS document and writes the document to modified.xps.

To see all of the XPS programming sample programs, see the XPS Programming Samples on MSDN Code Gallery.

Related topics

IOpcPartUri
IXpsOMCanvas
IXpsOMDocument
IXpsOMDocumentCollection
IXpsOMDocumentSequence
IXpsOMGeometry
IXpsOMGeometryFigure
IXpsOMGeometryFigureCollection
IXpsOMGlyphs
IXpsOMGlyphsEditor
IXpsOMImageBrush
IXpsOMImageResource
IXpsOMObjectFactory
IXpsOMPackage
IXpsOMPage
IXpsOMPageReference
IXpsOMPageReferenceCollection
IXpsOMPath
IXpsOMSolidColorBrush
IXpsOMVisual
IXpsOMVisualCollection
XPS_COLOR
XPS_GLYPH_INDEX
XPS_GLYPH_MAPPING
XPS_POINT
Common XPS Document Programming Tasks

 

 

Community Additions

ADD
Show:
© 2015 Microsoft