This document is archived and information here might be outdated. Recommended version. |
ArcObjects Help for .NET developers > ArcObjects namespaces > Framework > ESRI.ArcGIS.Framework > Interfaces > IA > IApplication Interface > IApplication.NewDocument Method (ArcObjects .NET 10.5 SDK) |
Creates a new document in this application.
[Visual Basic .NET] Public Sub NewDocument ( _ [ByVal selectTemplate As Boolean], _ [ByVal templatePath As String] _ )
[C#] public void NewDocument ( bool selectTemplate, string templatePath );
Optional Values
selectTemplate Specify True if you want the New document dialog to be opened to allow the user to select a template. [Optional]
templatePath is a string representing the path and filename of the template to base the new document on if selectTemplate is False. [Optional]
If selectTemplate is True, the New document dialog is displayed.
If templatePath is not specified, the New document dialog is displayed regardless of the value of selectTemplate.
Note, this method does not work in ArcCatalog.
The following example creates a new document in ArcMap using the Normal template. You would get m_app from the hook in ICommand::OnCreate().
// Get the path and filename of the Normal template
ITemplates pTemplates=m_app.Templates;
string normalPath=pTemplates.get_Item(0);
//Create a new document based on Normal
m_app.NewDocument(false, normalPath);
' Get the path and filename of the Normal template
Dim pTemplates As ITemplates=m_app.Templates
Dim normalPath As String=pTemplates.get_Item(0)
'Create a new document based on Normal
m_app.NewDocument(False, normalPath)