1

I have written an importscript which places articles into a Indesign masterspread from a xml file. Every article will be placed into a new textframe. Every article can have multiple pictures with a caption. The picture and caption will be grouped while the import and should be anchored into the articles textframe.

The Script runs well importing the articles, and placing the paragraphs into the created textframe. Every picture and caption will also grouped correctly.

But at this point im stuck. I cant figure out howto anchor the group into the given textframe.

var frameBounds = ["10", "10", "300mm", "300mm"];

Here i build the TextFrame

var article = xmlElements.placeIntoFrame(myDocument.pages.item(0), frameBounds);

Importing Picture and Caption

var picture = xmlElements.itemByName("Image").placeIntoFrame(myDocument.pages.item(0),  ["10", "10", "150mm", "100mm"]);
var caption = xmlElements.itemByName("Caption").placeIntoFrame(myDocument.pages.item(0),  ["10", "10", "150mm", "100mm"];

Grouping the Objects

Now want doing something like this.

This works:
var group =  app.activeDocument.groups.add([picture, signature], undefined,LocationOptions.AT_BEGINNING, article);
This doesnt work.
group.anchoredObjectSettings.anchoredPosition = AnchorPosition.ANCHORED;
Community
  • 1
  • 1
ThorKhan
  • 58
  • 8
  • If you found the answer to your question it belogns among the answers not in an edit of your question: [It’s OK to Ask and Answer Your Own Questions](http://blog.stackoverflow.com/2011/07/its-ok-to-ask-and-answer-your-own-questions/) – Rik Poggi Feb 07 '12 at 09:26
  • I know. But if you just have 3 Reputation Points you cant do that in the first 8 hours. – ThorKhan Feb 07 '12 at 13:54
  • The question was made yesterday, what's stopping you now? You can also delete your own question, but that's up to you. – Rik Poggi Feb 07 '12 at 14:33

1 Answers1

2

Found it by myself.

You have to insert:

group.anchoredObjectSettings.insertAnchoredObject(myElement.xmlElements[x].inser‌​tionPoints[0]); 

May it is useful for someone else... Cheers.

ThorKhan
  • 58
  • 8
  • Please, remove your answer from the question and post it here in your answer (cut and paste shouldn't be hard), then accept your own answer to let other people know that the issue here is solved. – Rik Poggi Feb 07 '12 at 18:48
  • I noticed that this works only for InDesign CS 5.5. The CS 5.0 DOM does not support group.anchoredObjectSettings.insertAnchoredObject. Is there a solution for CS5.0? –  Mar 23 '12 at 10:11