HOW TO

Set a map document's properties using ArcObjects

Last Published: April 26, 2020

Summary

In ArcMap, there is a Map Document Properties dialog that shows the following information fields about the .mxd file: Title, Summary, Description, Author, Credits, Tags and Hyperlink base.

The Map Document Properties dialog box

[O-Image]
Instructions provided describe how to access and changes these properties via the IDocumentInfo2 interface.

Procedure

The samples below show how to change the author, title, and description of the document.

  • VB.NET Sample

    Code:
    Dim pMapDoc As IMapDocument = New MapDocument()
    pMapDoc.Open("C:\\Untitled.mxd")
    Dim pDocInfo As IDocumentInfo2 = pMapDoc

    'Change the author of the document
    pDocInfo.Author = "Esri"

    'Change the title of the document.
    pDocInfo.DocumentTitle = "My Map Document"

    'Change the description of the document
    pDocInfo.Comments = "This is a demo."

    'Save the change
    pMapDoc.Save()

  • C# Sample

    Code:
    IMapDocument pMapDoc = new MapDocument();
    pMapDoc.Open("C:\\Untitled.mxd");
    IDocumentInfo2 pDocInfo = (IDocumentInfo2) pMapDoc;

    //Change the author of the document
    pDocInfo.Author = "Esri";

    //Change the title of the document.
    pDocInfo.DocumentTitle = "My Map Document";

    //Change the description of the document
    pDocInfo.Comments = "This is a demo.";

    //Save the change
    pMapDoc.Save();

  • JAVA Sample

    Code:
    IMapDocument pMapDoc = new MapDocument();
    pMapDoc.open("C:\\Untitled.mxd", "");
    IDocumentInfo2 pDocInfo = (IDocumentInfo2) pMapDoc ;

    //Change the author of the document
    pDocInfo.setAuthor("Esri");

    //Change the title of the document.
    pDocInfo.setDocumentTitle ("My Map Document");

    //Change the description of the documentpDocInfo.setComments ("This is a demo.");

    //Save the change
    pMapDoc.save(false, false);

Article ID:000013269

Software:
  • ArcObjects SDK for the Java Platform
  • ArcObjects SDK Microsoft NET Framework

Get help from ArcGIS experts

Contact technical support

Download the Esri Support App

Go to download options

Related Information

Discover more on this topic