Save PageLayoutControl contents to a map document (*.mxd)


PurposeThis sample demonstrates saving the contents of the PageLayoutControl to a map document (*.mxd). The PageLayoutControl is used in conjunction with the TOCControl, ToolbarControl, and the Control commands.

A Browse dialog box allows users to search and select map documents. The Open method of a new MapDocument object is passed the file name of the document selected on the Browse dialog box. The IPageLayoutControl.PageLayout property is set to the IMapDocument.PageLayout property. The TOCControl can be used to toggle layer visibility and the graphic element tools on the ToolbarControl can be used to add and reposition elements in the PageLayout.

The changes made to the PageLayout can be saved to the existing map document using the Save method or the changes can be saved to a new map document using the SaveAs method.

Development licensing Deployment licensing
Engine Developer Kit Engine Runtime
ArcView
ArcEditor
ArcInfo

How to use

See Using the samples for help on compiling, setting up the debugger, and running the sample (either an exe or dll).

  1. Browse and select a map document to load into the PageLayoutControl.
  2. Make changes to the PageLayout by toggling layer visibility and adding and repositioning graphic elements.
  3. Either save the changes to the original map document or save the changes into a new map document.

AssemblyInfo.cs Assembly information.
SaveMapDocument.cs Form file.
Download the C# files
AssemblyInfo.vb Assembly information.
SaveMapDocument.vb Form file.
Download the VB.NET files

Download the files for all languages

See Also:

PageLayoutControl class
IPageLayoutControl interface
MapDocument class
IMapDocument interface