Site logo

Frame can contain more than one object at a time

In InDesign a frame can only contain one object at a time, can’t it?

For the average InDesign user yes, but technically, that's not true.

Editing an IDML or IDMS file and open, or place it again can proof the contrary.

Also, a scripter can proof the contrary in adding one or more objects to another one.

Just run this script code (ExtendScript(JavaScript)) and expand the little triangle at the Rectangle element in the Layers Panel (InDesign CS5 and above):

var myDoc = app.documents.add();  
var myRectangle = myDoc.rectangles.add({geometricBounds:myDoc.pages[0].bounds}); 

myRectangle.ovals.add({geometricBounds:[0, 0,  100, 100], fillColor: "Yellow"});  
myRectangle.rectangles.add({geometricBounds:[0, 0, 75, 75], fillColor: "Magenta"}); 
myRectangle.polygons.add({geometricBounds:[0, 0,  48, 54], fillColor: "Yellow"});  
myRectangle.ovals.add({geometricBounds:[0, 0, 30, 30], fillColor: "Black"});
myRectangle.rectangles.add({geometricBounds:[0, 0, 15, 15], fillColor: "Cyan"});
// Should open the Layers Panel. If it will throw an error, the panel will not open
try {  
	app.panels.itemByName("$ID/#ImageLayersPanel").visible = true;  
} catch(e){};

The added document contains one page with a graphic frame that holds five different objects which are not grouped:

  1. a yellow circle
  2. a magenta rectangle
  3. a yellow polygon
  4. a black circle
  5. a blue rectangle

Thanks Uwe Laubender for the tip. The source is here.

Click here to download the script and the sample document (CC 2018).