Skip to main content
FarzanaA
Inspiring
July 7, 2026
Question

How to get kTextChar_FrameboxBreak character from a text frame on InDesignServer

  • July 7, 2026
  • 8 replies
  • 55 views

Hello All,

I am iterating text in each frame and where ever I find kTextChar_FrameBoxBreak character I need to delete that character and replace with paragraph return.

But when I get the text from a frame in WideString and get the last character, it gives me carriage return (kTextChar_CR) instead of frame box break character.

Has anyone tried to read this character through C++ plugin,

Thanks in advance.

Farzana.

    8 replies

    Community Expert
    July 8, 2026

    I don’t think you’re missing anything in the TextIterator loop. From what I remember, frame/column/page breaks are not stored as separate characters in the text model in the way you are expecting.

    The actual character you get back is normally kTextChar_CR. The “frame break” part is stored as a break-before / go-to-next-frame text attribute, rather than as a different Unicode character.

    So this check:

    cpp
    if (*iter == kTextChar_FrameBoxBreak)

    may never be true when reading existing text, even though inserting kTextChar_FrameBoxBreak works.

    You probably need to inspect the character attributes at that TextIndex, specifically the break-before / go-to-next-frame attribute, rather than only checking *iter.

    Look at:

    cpp
    kTextAttrGotoNextXBoss
    ITextAttrBreakBeforeMode

    If your end goal is to replace a frame break with a normal paragraph return, you may not need to delete and reinsert the character at all. The character is already a CR you likely need to remove/clear the break-before attribute so it behaves as a normal paragraph return.

    Also, double-check this line:

    cpp
    TextIterator endIter(textModel, iStartIndex + iEndIndex);

    If iEndIndex is already an absolute text index rather than a length, adding iStartIndex may make the range wrong.

    FarzanaA
    FarzanaAAuthor
    Inspiring
    July 8, 2026

    Hello Eugene,

    I tried the following with the help you had given but still did not work. It just gives “At page” in the alert.

     

    K2Vector<ClassID> attributeClasses;
    attributeClasses.push_back(kTextAttrBreakBeforeBoss);

    K2Vector<InDesign::TextRange> textRanges;
    InDesign::TextRange range(textModel, iStartIndex, iLength);
    textRanges.push_back(range);

    TextAttributeRunIterator runIter
    (
        textRanges.begin(),
        textRanges.end(),
        attributeClasses.begin(),
        attributeClasses.end()
    );

    InterfacePtr<ITextAttrBreakBeforeMode>iTextPosAttr((ITextAttrBreakBeforeMode*)(runIter->QueryByClassID(kTextAttrBreakBeforeBoss, IID_ITEXTATTRBREAKBEFOREMODE)));
    if (iTextPosAttr != nil)
    {
        
        if (iTextPosAttr->Get() == Text::kAtFrameBox)
            CAlert::InformationAlert("kTextChar_FrameBoxBreak");
        else if (iTextPosAttr->Get() == Text::kNoForcedBreak)
            CAlert::InformationAlert("kNoForcedBreak");
        else if (iTextPosAttr->Get() == Text::kAtColumn)
            CAlert::InformationAlert("kAtColumn");
        else if (iTextPosAttr->Get() == Text::kAtPage) 
            CAlert::InformationAlert("kAtPage");
        else if (iTextPosAttr->Get() == Text::kAtOddPage )
            CAlert::InformationAlert("kAtOddPage");
        else if (iTextPosAttr->Get() == Text::kAtEvenPage)
            CAlert::InformationAlert("kAtEvenPage");
        else
            CAlert::InformationAlert("nothing");
    }
     

    Also tried with classid “kTextAttrGotoNextXBoss”. that did not return any value.

    Thanks & Regards

    Farzana.

    Community Expert
    July 8, 2026

    Hi Farzana,

    Thinking about it, kTextAttrBreakBeforeBoss is probably not the attribute you’re looking for.

    Looks like it reports the paragraph break-before and Keep Options value, you’re probably getting the paragraph setting not the frame-break character.

    I’d give it a go for an inserted frame break, so the kTextChar_CR still applies. Then an attribute applied to that CR.

    You could test where the character is kTextChar_CR then query the attribute at that exact TextIndex, as one-character range.

    Something along these lines:

    cpp
    if (*iter == kTextChar_CR)
    {
        InDesign::TextRange crRange(textModel, currentIndex, 1);

        K2Vector<ClassID> attrClasses;
        attrClasses.push_back(kTextAttrGotoNextXBoss);

        K2Vector<InDesign::TextRange> ranges;
        ranges.push_back(crRange);

        TextAttributeRunIterator attrIter
        (
            ranges.begin(),
            ranges.end(),
            attrClasses.begin(),
            attrClasses.end()
        );

        InterfacePtr<ITextAttrBreakBeforeMode> breakAttr
        (
            (ITextAttrBreakBeforeMode*) attrIter->QueryByClassID
            (
                kTextAttrGotoNextXBoss,
                IID_ITEXTATTRBREAKBEFOREMODE
            )
        );

        if (breakAttr != nil && breakAttr->Get() == Text::kAtFrameBox)
        {
            // This CR is acting as a frame break.
        }
    }

    See if you can test this in a very simple document one text frame, plain paragraph style, no Keep Options, then insert only one manual frame break. That should remove the possibility that kAtPage is coming from paragraph formatting rather than the actual special break.

    Legend
    July 8, 2026

    Are you looking for the particular char, or for a frame break?

    Use InDesign desktop, select a manually inserted frame break and see the Info panel, to me it displays as Unicode 0xD .

    I don’t know how you’d enter the kTextChar_FrameBoxBreak (saw it handled in some very old code of mine so I must’ve come across cases), but you could differentiate that manual frame break from  _CR by looking for a  kTextAttrGotoNextXBoss in the character attributes …

    Legend
    July 8, 2026

    Also see the kTextChar comments in TextChar.h, e.g.

    kTextChar_PageBreak = 0xE00C;        // used in xml export

    Looks like they did not copy the comment for the other breaks, but use those special char only for XML export. Matches my old code which is also about XML.

    cartergray23456
    Participating Frequently
    July 8, 2026

    WideString may be converting the frame box break to kTextChar_CR automatically. Try iterating the text model/story instead of the extracted string, as the original kTextChar_FrameBoxBreak is often only available there.

    FarzanaA
    FarzanaAAuthor
    Inspiring
    July 8, 2026

    Hi,

    As mentioned I did try the following but did not get the output as needed.

    TextIterator iter(textModel, iStartIndex);
    TextIterator endIter(textModel, iStartIndex + iEndIndex);

    while (iter != endIter)
    {

        // Check against known InDesign special/control characters
        if (*iter == kTextChar_CR)
        {
            CAlert::InformationAlert("kTextChar_CR");
        }
        else if (*iter == kTextChar_FrameBoxBreak)
        {
            CAlert::InformationAlert("kTextChar_FrameBoxBreak");
        }
       
        ++iter;
    }

    It still gives kTextChar_Cr as the character value. Not sure what I am missing here.

     

    Thanks & Regards

    Farzana.