You are on page 1of 1

CHAPTER 2: Text Text containers 78

Solution

1. Use IMultiColumnTextFrame ::QueryFrameList to get the list of frames.

2. IFrameList::GetFrameIndex returns the index of the current frame in the list of frames.

3. Use IFrameList::GetFrameCount to get the total number of frames in the list.

4. Use IFrameList::QueryNthFrame to get a specified frame.

Sample code

SnpManipulateTextFrame::InspectFrameList code snippet

Modifying text frame options


A text frame has a set of associated options that describe how the text flows within the container,
including the following:

 Number of columns.

 Column width.

 Gutter (space between columns) width.

You can modify the options for a text frame.

Solution

To change the frame options for the current selection, use the ITextFrameOptionsSuite suite. For example,
to increment the number of columns, follow these steps:

1. Use ISelectionUtils::QuerySuite (on the kUtilsBoss class) to get the text frame options suite interface
(ITextFrameOptionsSuite).

2. Use ITextFrameOptionsSuite::GetColumnsAndGutter to get the number of existing columns.

3. Use ITextFrameOptionsSuite::CanApplyTextFrameOptions to test the ability to modify the frame


options.

4. This suite uses a data object to maintain the collection of options available for text frame. The API
provides an implementation that can be used (see ITextFrameOptionsData interface available on
kObjStylesTFOptionsCollectDataBoss). Create this boss object, and set the required state.

5. Use ITextFrameOptionsSuite::SetTFOColumns to apply the new columns value defined in the data
object to the selection.

To change the frame options for an arbitrary text frame (IMultiColumnTextFrame on


kMultiColumnItemBoss), use API-supplied commands. See the following figure, which shows commands
that Mutate Text Frame Options:

You might also like