When importing xml into Structured FrameMaker version 17, a soft return is 
embedded before the paragraph tag, pushing heading to the next line:
[cid:[email protected]]

It should look like this:
[cid:[email protected]]

In the xml xml:space="preserve" has been added because a tag is included in the 
xml:
<mainhead xml:space="preserve">Average annual total returns (%) <emphasis 
role="submainhead">(See important legal information)</emphasis></mainhead>

If I remove xml:space="preserve" , it eliminates the soft return but it does 
not recognize the tag, so the tag is not applied.

Microsoft CoPilot created  a script to remove these soft returns, but it is not 
working when I run it.
Any help resolving this will be appreciated.

Here is the script:

#target framemaker
function removeSoftReturnsInMainhead() {
    var doc = app.ActiveDoc;
    if (!doc.ObjectValid()) {
        alert("No active document.");
        return;
    }
    var pgf = doc.FirstPgfInDoc;
    var count = 0;
    while (pgf.ObjectValid()) {
        if (pgf.Element.ObjectValid() && pgf.Element.GI === "mainhead") {
            var tr = new TextRange();
            tr.beg.obj = pgf;
            tr.beg.offset = 0;
            tr.end.obj = pgf;
            tr.end.offset = Constants.FV_OBJ_END_OFFSET;
            var text = doc.GetText(tr);
            if (text && text.indexOf("\r") !== -1) {
                // Clean up soft returns
                var cleaned = text
                    .replace(/\r|\n/g, " ")
                    .replace(/\s+/g, " ");
                doc.SetText(tr, cleaned);
                count++;
            }
        }
        pgf = pgf.NextPgfInDoc;
    }
    alert("Done. Updated paragraphs: " + count);
}
removeSoftReturnsInMainhead();

----------------------------------------------------------------------

Unless notified to the contrary by the sender, the recipient should consider 
the contents of this message including any attachments to be confidential. If 
you are not the intended recipient and have received this message in error, 
please contact Federated Hermes immediately by forwarding this email to 
[email protected] and then delete this message from your system. 
Saving, copying or disseminating an inadvertently received email could violate 
state and Federal privacy laws. All emails received by or sent from Federated 
Hermes may be provided to regulators or law enforcement agencies, or used for 
other purposes consistent with Federated Hermes business interests. Thank you 
for your cooperation.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.png
Type: image/png
Size: 10642 bytes
Desc: image001.png
URL: 
<http://lists.frameusers.com/pipermail/framers-frameusers.com/attachments/20260622/e751e635/attachment.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image002.png
Type: image/png
Size: 11312 bytes
Desc: image002.png
URL: 
<http://lists.frameusers.com/pipermail/framers-frameusers.com/attachments/20260622/e751e635/attachment-0001.png>
_______________________________________________

This message is from the Framers mailing list

Send messages to [email protected]

Archives located at http://www.mail-archive.com/framers%40lists.frameusers.com/
Subscribe and unsubscribe at 
http://lists.frameusers.com/listinfo.cgi/framers-frameusers.com
Send administrative questions to [email protected]

Reply via email to