tag:blogger.com,1999:blog-2909088349875842828.post49315949226018389..comments2023-01-07T10:31:27.955-05:00Comments on Extending FrameMaker: Text NodesDebra Hermanhttp://www.blogger.com/profile/16336331080547778765noreply@blogger.comBlogger5125tag:blogger.com,1999:blog-2909088349875842828.post-22989070309385935922012-05-02T14:56:09.603-04:002012-05-02T14:56:09.603-04:00No error codes, it just didn't add anything wi...No error codes, it just didn't add anything with the AddText when I tried to add to the beginning TextLoc of the element. Also it seemed impossible to select the existing text content within the element.<br /><br />I tried at least the following:<br /><br />var eTr = elem.TextRange<br />doc.TextSelection = eTr<br /><br />Which selected the entire element (not just the text content)<br /><br />And:<br /><br />var eTr = elem.FirstChildElement.TextRange (I figured this would be the -element, at least the same selection produced "null", when I alerted the ElementDef.Name)<br /><br />doc.TextSelection = eTr <br /><br />Which didn't select anythingshokkanennoreply@blogger.comtag:blogger.com,1999:blog-2909088349875842828.post-18706044110813208942012-05-02T10:09:53.326-04:002012-05-02T10:09:53.326-04:00It should be possible to add directly to the text ...It should be possible to add directly to the text node if you have the right insertion point. <br /><br />Did you get an error code when you tried your add?Debra Hermanhttps://www.blogger.com/profile/16336331080547778765noreply@blogger.comtag:blogger.com,1999:blog-2909088349875842828.post-89688149221473103772012-05-02T08:30:33.541-04:002012-05-02T08:30:33.541-04:00Hi, thanks for the reply.
I couldn't figure ...Hi, thanks for the reply. <br /><br />I couldn't figure out how to edit the element text content in any smart way, so I finally avoided the problem by creating a similar new element with new content next to the old one (ElementDef.WrapElement()) and then deleting the deprecated one. It's not beautiful but it works :)<br /><br />Editing text node contents should be basic stuff (I think?) so it was a big surprise how difficult it was.shokkanennoreply@blogger.comtag:blogger.com,1999:blog-2909088349875842828.post-51533379233133788932012-05-01T12:08:43.269-04:002012-05-01T12:08:43.269-04:00Hello,
I have not had a chance to create an examp...Hello,<br /><br />I have not had a chance to create an example but my quick thought is that when working with elements, you need to use the data structure ElementRange rather than TextRange. Text ranges are applicable only when working with paragraphs.Debra Hermanhttps://www.blogger.com/profile/16336331080547778765noreply@blogger.comtag:blogger.com,1999:blog-2909088349875842828.post-78958309496425992352012-05-01T07:59:59.960-04:002012-05-01T07:59:59.960-04:00Hi!
Thanks for the awesome blog, your articles ar...Hi!<br /><br />Thanks for the awesome blog, your articles are a great ExtendScript information source.<br /><br />I'm working on a script which would change the content of TEXT -nodes and just can't figure out how to do it. I've been trying to select/delete/add -text within a TEXT -node and it just doesn't work - I must be doing something wrong.<br /><br />My approach has been that the element is a child of another element, let's say "elem" so I've been trying to select the text like <br /><br />var childelem = elem.FirstChildElement<br />var tRange = childelem.TextRange<br /><br />... and work on the text - and no luck...shokkanennoreply@blogger.com