2 Replies Latest reply on Feb 3, 2016 2:42 AM by selvam214

    Inline object to anchor, release, ungroup, again anchor in same insertion point position

    selvam214 Level 1

      Hi All,

      I have a difficult to export the word doc with grouped inline objects, sample screenshot below.

      Screen shot 2016-02-02 at 12.45.39 PM.png

      I have planned to change the inline position to anchor, then release, and ungroup, again anchor in the same position.

       

       

       

       

      I have tried up to the ungroup, and need a help to anchor in same position (collect GEOMETRIC position and anchor based on the collected position). Kindly help on this topic.

       

      if (app.documents.length > 0) {

          pageItems = app.documents[0].allPageItems;

          for (i = pageItems.length-1; i >= 0; i--) {

                  if (pageItems[i].parent instanceof Character) {

              if (pageItems[i].anchoredObjectSettings.anchoredPosition !== AnchorPosition.ANCHORED) {

                  pageItems[i].anchoredObjectSettings.anchoredPosition = AnchorPosition.ANCHORED;

              }

              pageItems[i].anchoredObjectSettings.releaseAnchoredObject();

          }

          }

      }

       

      Thanks,

      Selva

       

       

       

       

      Another step to forward here, but can't do the anchor:

       

       

       

       

      if (app.documents.length > 0) { 

          pageItems = app.documents[0].allPageItems; 

          for (i = pageItems.length-1; i >= 0; i--) { 

                  if (pageItems[i].parent instanceof Character) { 

                      myGeometricBounds=pageItems[i].geometricBounds;

                      var myWidth = myGeometricBounds[0];

                      var myHeight = myGeometricBounds[1];

                      alert("my X position: "+myHeight+"\rmy Y position: "+myWidth) ;

                      if (pageItems[i].anchoredObjectSettings.anchoredPosition !== AnchorPosition.ANCHORED) {

                          pageItems[i].anchoredObjectSettings.anchoredPosition = AnchorPosition.ANCHORED;

                      }

                  pageItems[i].anchoredObjectSettings.releaseAnchoredObject();

                  try{

                  pageItems[i].ungroup();

                  }catch(e){};

                  pageItems[i].move([myHeight, myWidth]);

                  }

              }

          }