// This successfully saves a copy of the current document to a new location (C#): ArcMap.Application.SaveAsDocument(@C:\temp\testsaveIapp.mxd, true);
Public Sub SaveDoc() Try Dim pMxDoc As IMxDocument = m_application.Document Dim pMap As IMap = pMxDoc.FocusMap Dim pmxdPathName As String Dim pMapDoc As IMapDocument = New MapDocument Dim pMxdContents As IMxdContents = pMap pmxdPathName = "C:\Documents and Settings\ruchira.welikala\Desktop\GIS Stuff\PracticeShapefiles\TestMXD" & Math.Round(Date.Now.Millisecond, 3) & ".mxd" pMapDoc.[New](pmxdPathName) pMapDoc.ReplaceContents(pMxdContents) pMapDoc.SetActiveView(pMxDoc.ActiveView) pMapDoc.Save(True, False) Catch ex As Exception MsgBox(ex.Message) End Try End Sub
// Load the current map document's file into a new IMapDocument IMapDocument mapDocument = new MapDocumentClass(); mapDocument.Open(((IDocumentInfo2)ArcMap.Document).Path, ""); // Replace the contents with the current contents mapDocument.ReplaceContents((IMxdContents)ArcMap.Document.PageLayout); // Save to a different file mapDocument.SaveAs("C:/temp/testsave.mxd", mapDocument.UsesRelativePaths, false); mapDocument.Close();
// Load the current map document's file into a new IMapDocument Dim pDocInfo as IDocumentInfo2 = DirectCast(m_app.Document, IDocumentInfo2) Dim pCurDocPath as String = pDocInfo.Path Dim pMapDocument as IMapDocument = New MapDocumentClass() pMapDocument.Open(pCurDocPath, String.Empty) // Replace the contents with the current contents pMapDocument .ReplaceContents(CType(m_app.Document.PageLayout, IMxdContents)) // Save to a different file mxdPathName As String = strDefaultWorkspace & "\" & frmWSIn.txtMapDocName.Text pMapDocument.SaveAs(mxdPathName, pMapDocument.UsesRelativePaths, False) pMapDocument.Close()
//Dim pMxDoc As IMxDocument = DirectCast(m_app.document, IMxDocument) IMxDocument mxDocument = ArcMap.Document; //Dim pMap As IMap = pMxDoc.FocusMap IMap map = mxDocument.FocusMap; //Dim pMapDoc As IMapDocument = pMap IMapDocument mapDocument = map as IMapDocument; //Dim mxdPathName As String //mxdPathName = strDefaultWorkspace & "\" & frmWSIn.txtMapDocName.Text string mxdPathName = "C:/temp/testsave.mxd"; //pMapDoc.SaveAs(mxdPathName) mapDocument.SaveAs(mxdPathName, false, false);
IMapDocument mapDocument = new MapDocumentClass(); mapDocument.Open("C:/temp/mymap.mxd", ""); string mxdPathName = "C:/temp/testsave.mxd"; mapDocument.SaveAs(mxdPathName, false, false);
IMapDocument mapDocument = (IMapDocument)ArcMap.Document; string mxdPathName = "C:/temp/testsave.mxd"; mapDocument.SaveAs(mxdPathName, false, false);
Sub WhateverName() [INDENT] Try Dim pMxDoc As IMxDocument = DirectCast(m_app.document, IMxDocument) Dim pMap As IMap = pMxDoc.FocusMap Dim pMapDoc As IMapDocument = pMap Dim mxdPathName As String mxdPathName = strDefaultWorkspace & "\" & frmWSIn.txtMapDocName.Text pMapDoc.SaveAs(mxdPathName) Catch ex as Exception Msgbox(ex.Message) End Try [/INDENT] End Sub
Angemeldete Mitglieder können Beiträge verfassen, Updates folgen und mehr. Neu hier? Registriere ein kostenloses Konto.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.