Question

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;
Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top