3 Replies Latest reply on Oct 8, 2012 1:50 AM by HansSH04

    Selecting pasted text




      I'm looking for a way to select a block of text which I just pasted into a textframe. Is there any way to do this?


      I'm using CS4 (6.0.6) and the text block originates from Word 2010 (although Word 97 format).


      Thanks a lot.



        • 1. Re: Selecting pasted text
          Dingenskirchen2012 Level 1

          No way to do this? OK, then let me ask the question in a different way.


          I'm not an XML expert so bear with me if I use the wrong terms here. What I'm generally trying to do is to "connect" pasted text blocks with the document's XML structure. The reason behind this is that I need to be able to swap out blocks of text later to update the document. All I managed to do is to get the beginning of the pasted block into the document's structure, but not the whole block.


          Thanks for your help.



          • 2. Re: Selecting pasted text
            benjaminmueller_burda Level 1



            let me try to understand ... you want to insert the pasted text into an XML-Element in your document structure?  Not really a problem.  First you need to find the location in the XML DOM where you want to put the text (or just add an XML-Element there).


            storyRootTag = thisStory.associatedXMLElement;

            xmlElement = storyRootTag.xmlElements.add("THE_XML_ELEMENT");


            Then, with the XML-Element do something like


            xmlElement.insertionPoints.item(-1).contents = <YOUR PASTED TEXT>


            If you want to do it in one go (Command-V) you need to attach an EventHandler to that keystroke (even though overriding the default is never a good idea).





            • 3. Re: Selecting pasted text
              HansSH04 Level 1

              Sorry for not replying earlier. Something came up and this issue had to wait.



              Yes, that's pretty much what I do. My problem is (I should've been more clear about that) how to get <YOUR PASTED TEXT>. I can't find any object that contains the stuff I pasted into my document (using Application.Paste() ). I'm kinda stuck here.


              Thanks again.