In this topic
Documents and templates
Understanding documents and templates is an essential part in understanding customization with ArcObjects in ArcGIS Desktop applications.
Whenever you are using ArcMap, ArcGlobe, or ArcScene, you are working with a document, usually referred to as a map, globe, or scene document. This document stores the map state, the state of the user interface, custom user interface settings, a Visual Basic for Applications project, and other application-specific information, such as cartographic layouts for ArcMap documents.
Templates are kinds of documents that serve as starting points for new documents. All the desktop applications have a template known as the Normal template, which stores the default or original state of the application. ArcCatalog is a special case because it only uses the Normal template and has no documents.
As a desktop developer you can store your customizations in either the current document or the Normal template. ArcMap developers can also store the customizations in another map template usually established for different cartographic layouts.
When you open a desktop document, the corresponding desktop application first reads the customizations from the Normal template, then the map template, if applicable, then finally the document itself. The graphic below illustrates how customizations are read from top to bottom to incorporate customizations from all levels.
The order in which these are read is important because changes in one template can affect other templates and the desktop document. For example, an ArcMap Normal template may have the AddData command turned off, but a map template or document may turn the command back on.
The structure and function of documents and templates are further explained below in the context of each respective application.
Customizing ArcMap
You can customize ArcMap in several ways:
-
You can add references to geographic data and define how the data is displayed.
-
You can create a map layout with a spatial reference and ancillary cartographic elements.
-
You can add, remove, or rearrange elements of the standard user interface.
-
You can write code in a Visual Basic for Applications project.
All customization in ArcMap is stored in a map document or a map template.
ArcMap automatically creates a Normal template if one does not exist. If you have applied unintended customizations, such as removing toolbars and command items, you can simply remove the Normal.mxt file, and a new one with the standard user interface will be generated. This is easier than undoing a set of unintended customizations.
The changes you make to the ArcMap table of contents, the layout of a map, the toolbars and their command items, and the VBA code you write all get saved to the map document.
A map document can reside anywhere on your file system; it has a file extension of .mxd.
Map templates
You can use map templates to disseminate customization throughout an organization—globally, by project, or by document.
A map template is a kind of map document. In nearly every respect, map templates are structurally identical to map documents. The functional difference is that ArcMap recognizes and uses templates as a starting point to create new map documents. This is similar to how you work with templates in Microsoft Office applications.
Any customization of the user interface or the VBA project becomes part of the newly created map document. Furthermore, any changes to a template will propagate to template-based documents when they are next loaded.
There are three levels of templates and documents in ArcMap. You can save changes to any level to control how widely your customizations are used.
This is how the three loaded templates in ArcMap—normal, project (current document), and project template—appear in the VBA project explorer.
Custom map documents
When you are working with a map, you are setting references to data, designing a map layout, customizing the user interface, and writing VBA code, all for the lifetime of the document.
Selective customization with project templates
Other projects and other users can share the customizations that you make through templates. A template is a kind of map document that is specified to be a starting point for a new map document. The new map document will inherit all the customizations from the template (data references, map layout, user interface state, and VBA project).
Global customizations with the Normal template
The Normal template in ArcMap stores any personal settings you have made to the user interface that you want loaded every time you start ArcMap. Any customizations that you save to the Normal template, including code and control customizations, will get propagated to all the other map documents when they are next opened.
In ArcMap the Normal template is also referred to as the Normal.mxt file.
When you first start ArcMap after installing the software, a Normal template is automatically created and put in your profiles location, which is one of the following folders, depending on your operating system.
For Windows NT®:
C:\WINNT\Profiles\<your username>\Application Data\ESRI\ArcMap\Templates\
For Windows 2000 and XP:
C:\Documents and Settings\<your username>\Application Data\ESRI\ArcMap\Templates\
This is the default Normal template that contains all the standard toolbars and commands and places the toolbars and the table of contents in their default positions. Any customizations that you save in your Normal template get saved to this file.
If you want to make changes that appear every time you open ArcMap, save them in the Normal template.
Suppose your administrator has custom toolbars or tools to which he or she would like everyone in your organization to have access. Your administrator could create a customized Normal template and allow everyone in your organization to use that Normal template instead of the default Normal template. To accomplish this, your administrator would customize the Normal template and copy that Normal.mxt file to the C:\Program Files\ArcGIS\bin\Templates folder. Everyone would then start with this Normal template instead of the default Normal template. The following is an explanation of how this works.
If there is no Normal.mxt file in your profiles location when you start ArcMap, the application will look in the C:\Program Files\ArcGIS\bin\Templates folder. If a Normal.mxt file exists in the C:\Program Files\ArcGIS\bin\Templates folder, that file will be copied to your profiles location and will be treated as your personal Normal template. Therefore, you start off with a copy of your organization's customized Normal template, but from that point on you can save your own customizations to it.
If a Normal.mxt file is not found in your Profiles location or in the C:\Program Files\ArcGIS\bin\Templates folder, then a new default Normal.mxt file will be created and placed in your Profiles location.
Customizing ArcScene and ArcGlobe
ArcScene and ArcGlobe can be customized in the following ways:
-
You can add references to geographic data and define how the data is displayed.
-
You can add, remove, or rearrange elements of the standard user interface.
-
You can write code in a Visual Basic for Applications project.
All customizations are stored as documents. For ArcScene the document extension is .sxd; for ArcGlobe it is .3dd.
The changes you make to the table of contents, the toolbars and their command items, and the VBA code you write all get saved to these documents.
Like ArcMap, these applications also have a Normal template that behaves the same way. For ArcScene the file is called Normal.sxt; for ArcGlobe it is Normal.3dt. You can find these files at the following locations, depending on your operating system:
For Windows NT:
C:\WINNT\Profiles\<your username>\Application Data\ESRI\ArcScene (or ArcGlobe)
For Windows 2000 and XP:
C:\Documents and Settings\<your username>\Application Data\ESRI\ArcScene (or ArcGlobe)
Customizing ArcCatalog
You can customize ArcCatalog in several ways:
-
Add, remove, or rearrange elements of the standard user interface.
-
Write code in a Visual Basic for Applications project.
ArcCatalog does not employ the full structure of documents and templates like ArcMap does. The ArcCatalog application does not use documents or base templates; it only uses a Normal template. Therefore, all customizations to the ArcCatalog user interface are stored in the Normal template.
This is how the ArcCatalog Normal template appears in the VBA project explorer.
When you first start ArcCatalog after installing the software, a Normal template called Normal.gxt is automatically created and put in your Profiles location, which is one of the following folders, depending on your operating system.
For Windows NT:
C:\WINNT\Profiles\<your username>\Application Data\ESRI\ArcCatalog\
For Windows 2000:
C:\Documents and Settings\<your username>\Application Data\ESRI\ArcCatalog\