You are on page 1of 1

CHAPTER 1: Layout Documents 11

Saving a document
Saving a document to a file

Solution

If you already know where the file to save into is located or you want full control over how the user is
prompted for the file location, call IDocumentCommands::SaveAs.

If you want the user to be asked to identify the file to save to using the application’s save file dialog, call
IDocFileHandler::SaveAs.

Sample code

SDKLayoutHelper::SaveDocumentAs

Related API

IDocumentCommands

Saving a document

You can save a document that was saved to a file at least once before (IDocument::IsSaved indicates this).

Solution

Call one of the following

 IDocumentCommands::Save

 IDocFileHandler::Save

Related APIs

 IDocument

 IDocumentCommands

 IDocFileHandler

Closing a document
Solution

To close any layout windows that are open, then schedule a command to close the document, use
IDocFileHandler::Close.

To process a command to close the document immediately, use IDocumentCommands::Close.

Sample code

SDKLayoutHelper::CloseDocument

You might also like