Skip to main content
Inspiring
February 10, 2021
Answered

How to get the text that is inside an anchored text frame

  • February 10, 2021
  • 3 replies
  • 814 views

Using C++ how can I get the text that is inside an anchored text frame.

I do have the UIDRef of the ancher text frame, but I am not able to get the text inside it.

 

appreciate the help,

Joe

This topic has been closed for replies.
Correct answer IGS 5CC

Oops :

InterfacePtr<IHierarchy> iInlineHierarchy(_UIDRef_you_have_, IID_IHIERARCHY);
// The first child is the kSplineItemBoss of the nested text frame
InterfacePtr<IHierarchy> iSplineHierarchy(iInlineHierarchy->QueryChild(0));
// kMultiColumnItemBoss
InterfacePtr<IHierarchy> iMultiColumnItemHierarchy(iSplineHierarchy->QueryChild(0));
// kFrameItemBoss
InterfacePtr<IHierarchy> iFrameItemHierarchy(iMultiColumnItemHierarchy->QueryChild(0));

// I forgot this
InterfacePtr<ITextFrameColumn> iTextFrameColumn(iFrameItemHierarchy, IID_ITEXTFRAMECOLUMN);

InterfacePtr<IFrameList> iFrameList(iTextFrameColumn->QueryFrameList());
InterfacePtr<ITextModel> iTextModel(iFrameList->QueryTextModel());

3 replies

Participant
February 12, 2021

If you have the UIDRef of the inline item then you have to use hierarchy to get the nested text frame :

InterfacePtr<IHierarchy> iInlineHierarchy(_UIDRef_you_have_, IID_IHIERARCHY);
// The first child is the kSplineItemBoss of the nested text frame
InterfacePtr<IHierarchy> iSplineHierarchy(iInlineHierarchy->QueryChild(0));
// kMultiColumnItemBoss
InterfacePtr<IHierarchy> iMultiColumnItemHierarchy(iSplineHierarchy->QueryChild(0));
// kFrameItemBoss
InterfacePtr<IHierarchy> iFrameItemHierarchy(iMultiColumnItemHierarchy->QueryChild(0));
InterfacePtr<IFrameList> iFrameList(iFrameItemHierarchy->QueryFrameList());
InterfacePtr<ITextModel> iTextModel(iFrameList->QueryTextModel());

 

Now, you have the ITextModel of your nested text frame and you can get the text.

Inspiring
February 12, 2021

Thank you very much for your help. I have an issue with the following:

InterfacePtr<IFrameList> iFrameList(iFrameItemHierarchy->QueryFrameList())

 

 iFrameItemHierarchy has no member QueryFrameList();

 

Appreciate,

Joe

IGS 5CCCorrect answer
Participant
February 12, 2021

Oops :

InterfacePtr<IHierarchy> iInlineHierarchy(_UIDRef_you_have_, IID_IHIERARCHY);
// The first child is the kSplineItemBoss of the nested text frame
InterfacePtr<IHierarchy> iSplineHierarchy(iInlineHierarchy->QueryChild(0));
// kMultiColumnItemBoss
InterfacePtr<IHierarchy> iMultiColumnItemHierarchy(iSplineHierarchy->QueryChild(0));
// kFrameItemBoss
InterfacePtr<IHierarchy> iFrameItemHierarchy(iMultiColumnItemHierarchy->QueryChild(0));

// I forgot this
InterfacePtr<ITextFrameColumn> iTextFrameColumn(iFrameItemHierarchy, IID_ITEXTFRAMECOLUMN);

InterfacePtr<IFrameList> iFrameList(iTextFrameColumn->QueryFrameList());
InterfacePtr<ITextModel> iTextModel(iFrameList->QueryTextModel());
BarlaeDC
Community Expert
Community Expert
February 11, 2021
Inspiring
February 11, 2021

Thank you for your suggestion. I am able to get the list of the inline items in a frame. The issue remains, that I am not able to get the text that is inside the inline item.

 

Appreciate the help,

Joe

Ian Sayers
Inspiring
February 10, 2021

Please explain more about how you are wanting to access this ? C++ programming language ?

 

What are you trying to achieve with this ?

Inspiring
February 11, 2021

I am creating an InDesign PlugIn.

I am looping to get the text inside the anchored text boxes. I am able to get the text inside the parent text frame and identify the anchor text frame itself. However, I am not able to get the text inside the child(anchored) frame.

 

Appreciate the help.

Joe