Download as pdf or txt
Download as pdf or txt
You are on page 1of 1

CHAPTER 1: Layout Documents 12

Related API

IDocument

Iterating through documents


You can examine all open documents.

Solution

1. Use the session returned from GetExecutionContextSession() to call ISession::QueryApplication.

2. Call IApplication::QueryDocumentList.

3. Examine the documents using IDocumentList

Sample code
InterfacePtr<IApplication> application(GetExecutionContextSession()
->QueryApplication());
InterfacePtr<IDocumentList> documentList(application->QueryDocumentList());
for (int32 i = 0; i < documentList->GetDocCount(); i++) {
IDocument* document = documentList->GetNthDoc(i);
PMString name;
document->GetName(name);
}

Related API

IDocument

Finding the default InDesign document setup


You can find the properties displayed in the File > Document Setup and File > New Document dialogs.

Solution

To get the defaults inherited by new documents, use IPageSetupPrefs on kWorkspaceBoss.

To get the settings for a document, use IPageSetupPrefs on kDocWorkspaceBoss.

Sample code

SnpModifyLayoutGrid

Related API

IPageSetupPrefs

You might also like