3 Replies Latest reply on Oct 3, 2018 2:12 AM by Laubender

    move anchor position

    Level 1

      I have placed the anchor object based on the XML element insertion point. I need to move the anchor position to previous sibling element how to do this.

       

      or How to move the anchor object to previous para and remove the unwanted enter mark.

      Move_anchor.PNG

        • 1. Re: move anchor position
          Laubender Adobe Community Professional & MVP

          To move the anchored text frame you have to move the character, that is representing the anchored object in your text flow.

          If you select your anchored text frame, the parent of that will be the character to move.

           

          Something like that should work:

           

          var anchoredObject = app.selection[0];
          var characterToMove = anchoredObject.parent;
          var mainStory = characterToMove.parent;
          
          var indexOfFirstInsertionPoint = characterToMove.paragraphs[0].insertionPoints[0].index;
          
          characterToMove.move
          (
              LocationOptions.BEFORE ,
              mainStory.insertionPoints[indexOfFirstInsertionPoint-1]
          );
          

           

          Did not test that with XML tagged contents.

           

          Regards,
          Uwe

          • 2. Re: move anchor position
            Mnietek1 Level 1

            Unfortunately when i move anchored objects this way all tags in moved anchored objects are removed.

            When I duplicate object instead of move it - tags are preserved.

            Is there any other way to move anchored objects?

             

            (ID CC 2018)

            • 3. Re: move anchor position
              Laubender Adobe Community Professional & MVP

              There are methods move() and duplicate() for e.g. characters. That's it.

              Try duplicate() and remove the original.

               

              Regards,
              Uwe