Save map document


Purpose
This sample demonstrates how to save the contents of the PageLayout control to a map document (.mxd file). The PageLayout control is used in conjunction with the TOC control, Toolbar control, and the control commands.
 
The browse dialog allows you to search and select map documents. The Open method of a new MapDocument object is passed the filename of the document selected in the browse dialog. The IPageLayoutControl.PageLayout property is set to the IMapDocument.PageLayout property. The TOC control can be used to toggle layer visibility, and the graphic element tools on the Toolbar control can be used to add and reposition elements in the PageLayout control.
 
The changes made to the PageLayout control 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.

How to use

See How to use ArcGIS samples for help on running the sample. If the sample has associated data, you will find that the sample's zip file includes a "data" folder alongside the language folders. However, you will need to update the sample to point to the location of the data once you have extracted all the files.

  1. Run the SaveMapDocument application.
  2. Browse and select a map document to load into the PageLayout control.
  3. Add a graphic element to the map and save the document.
  4. Load the saved document to ensure that the newly added graphic was saved.


Download the files for Java
pagelayoutbean/SaveMapDocument.java Main class




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