1 Reply Latest reply on Sep 18, 2016 9:50 PM 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