[GIS] How to close the current mxd document through arcmap add-in

add-inarcmaparcobjectsc

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#?

Best Answer

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.

Related Question