You are on page 1of 1

CHAPTER 1: Layout Page items 36

To add more than one page items to a hierarchy, use kAddToHierarchyCmdBoss.

Iterating through frame content


You can examine the content of a frame.

Solution

Query the frame for IFrameType to find the type of frame you have

Finding the frames in a spread


Solution

1. Call ISpread::GetItemsOnPage to get the page items

2. Call IPageItemTypeUtils to find the type of each page item, or query the page items for an IFrameType
interface.

Sample code

CHMLFiltHelper::collectGraphicFrames

Related APIs

 IHierarchy

 ISpread

Searching for page items (objects) with certain attributes


You may want to search/replace page items with certain graphic attributes. This section describes how to
set search/replace options and find page items (objects) according to object style, frame type, and graphic
attributes.

Solution

1. Set search mode to IFindChangeOptions::kObjectSearch, using kFindSearchModeCmdBoss.

2. In IFindChangeOptions, set object type to find, using kObjectSearchTypeCmdBoss. You can choose
from all frame types, graphic frames, and unassigned frames.

3. Set search scope using kScopeCmdBoss. The scope can be the current document, all open documents,
or within the current selection. Do not forget to explicitly set the IID_IFINDCHANGEMODEDATA
interface on the command bosses to IFindChangeOptions::kObjectSearch search mode.

4. Choose an object style to search, and prepare an attribute boss list to store graphic attributes that
your found page item should have. Then, set the find object style and find attribute list using
kFindChangeFormatCmdBoss.

You might also like