3

First, I open a mxd document named A in arcmap, then i use my add-in to generate another mxd document named B,

then I use

 ArcMap.Application.OpenDocument(arcmapMapFileName);

to open the document, but the document does not display normally, it has both A and B's layers. I want to only open B, so before open B, I have to close A.

How can I achieve this through an arcmap add-in in c#?

3
  • 1
    There is no method for closing a document within ArcMap. Just open file menu in ArcMap and you will see there is no close option! IMapDocument has a close method but this is not for desktop which you are developing for. Maybe you can use NewDocument to reset?
    – Hornbydd
    Aug 21 '13 at 10:13
  • Dose it have replace method?
    – Hmily Shao
    Aug 21 '13 at 10:26
  • Did you ever solved this problem?
    – Ms. Smith
    May 3 '18 at 9:56
1

IApplication.NewDocument http://help.arcgis.com/en/sdk/10.0/arcobjects_net/componenthelp/index.html#/NewDocument_Method/00230000003s000000/

to create a new empty document then just open the new document

IApplication.OpenDocument http://help.arcgis.com/en/sdk/10.0/arcobjects_net/componenthelp/index.html#/OpenDocument_Method/00230000003t000000/

to teminate: IApplication.Shutdown http://help.arcgis.com/en/sdk/10.0/arcobjects_net/componenthelp/index.html#/Shutdown_Method/002300000043000000/

Terminates the application!

Never used this one myself but bumped into it a few years ago and remember thinking it would be useful.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.