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.

  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.

If you installed the samples feature, you will find the files associated with this sample in <Your Developer Kit install location>\DeveloperKit10.4\Java\Samples\ArcObjects.

pagelayoutbean/SaveMapDocument.java Main class




Development licensing Deployment licensing
Engine Developer Kit Engine
ArcGIS for Desktop Basic
ArcGIS for Desktop Standard
ArcGIS for Desktop Advanced