Professional Documents
Culture Documents
Sample code
The following example demonstrates how to create a vertical ruler guide item on the first page of the
active spread. For code simplicity, error checking is omitted.
InterfacePtr<ILayoutControlData>
layoutData(Utils<ILayoutUtils>()->QueryFrontLayoutData());
// Get the active document layer
InterfacePtr<IDocumentLayer> docLayer(layoutData->
QueryActiveDocLayer());
// The parent for the new guide is the guide spread layer.
UID parent = ::GetUID(spreadLayer);
UIDRef parentUIDRef(db, parent);
// Get the first page UID. ownerUID is a page for short guides.
UID ownerUID = spread->GetNthPageUID(0);
// Note: The parent for the guide we are to create is the spread. Each
// page owns its guides. We need to convert the guide coordinates
// to its parent space - spread space.
InterfacePtr<ICommand> newGuideCmd(CmdUtils::CreateCommand(kNewGuideCmdBoss));
if (CmdUtils::ProcessCommand(newGuideCmd) != kSuccess)
// Report process command failure.
Related APIs
IGuideData