Close Method (Boolean)


Closes the document with the option to save.

Namespace: Autodesk.Revit.DB
Assembly: RevitAPI (in RevitAPI.dll) Version: 2015.0.0.0 (2015.0.0.0)

Syntax

C#
public bool Close(
	bool saveModified
)
Visual Basic
Public Function Close ( _
	saveModified As Boolean _
) As Boolean
Visual C++
public:
bool Close(
	bool saveModified
)

Parameters

saveModified
Type: System Boolean
Indicates if the current document should be saved before close operation.

Return Value

False if closing procedure fails or if saving of a modified document was requested (saveModified = True) but failed. Also returns False if closing is cancelled by an external application during 'DocumentClosing' event. When function succeeds, True is returned.

Remarks

The currently active document may not be closed by this function. It can only be closed via Revit's UI.

Exceptions

Exception Condition
Autodesk.Revit.Exceptions InvalidOperationException Thrown when attempting to close the currently active document. Thrown if there are any transactions, sub-transactions or transaction groups which were opened by the API code, and not closed. All of these items must be handled before attempting to close the document. Thrown if saveModified is 'true' and the PathName is not set yet. Thrown if saveModified is 'true' and the saving target file is read only.
Autodesk.Revit.Exceptions InvalidOperationException Thrown if this a linked file.

See Also