Skip to main content
Inspiring
January 20, 2023
Question

How to automatically add horizontal line between images

  • January 20, 2023
  • 4 replies
  • 1138 views

I have columns of placed graphics that I would like to add a horizontal line between, much like adding a vertical line between columns using Text Frame Options or the Object Style Optons dialog.

 

I have looked for a script with no luck and I can't seem to figure out if object styles will apply a horizontal line only between objects.

Any ideas would be greatly appreciated.

This topic has been closed for replies.

4 replies

Legend
January 20, 2023

You could set up a table to contain the images, and set borders only on the strokes between frames.

James Gifford—NitroPress
Legend
January 20, 2023

Given the subsequent issues of getting tables to flow across pages, I'd say the better solution is something attached to the anchor paragraph style. If the existing work doesn't use anchored frames, it will take some time to go through and anchor each to a specific paragraph style... but once that's done, it will be easy to experiment with that style to achieve the desired effect. I'd suggst Rule Below is the right approach, and for bottom (of page, or stack) images, a secondary style that has no rule below.

 

But pretty much every good solution has to start with the image frames cleanly anchored to a specific para style, and a good object style definition wouldn't hurt.

 

brian_p_dts
Community Expert
Community Expert
January 20, 2023

Are the placed graphics anchored in a text flow, or standalone?

ht354Author
Inspiring
January 20, 2023

At present all items are standalone.

 

brian_p_dts
Community Expert
Community Expert
January 20, 2023

Something like this could work. 

var d = app.activeDocument;
var allgs = d.allGraphics;
var i = allgs.length;
var os = d.objectStyles.itemByName("LineObj");
var offset = 3;
var r, gb, l, p;
while(i--) {
    p = allgs[i].parent;
    gb = p.geometricBounds;
    l = p.graphicLines.add(undefined, undefined, undefined, {appliedObjectStyle: os});
    l.geometricBounds = [gb[2] + offset, gb[1], gb[2] + offset, gb[3]];
}

 

Peter Spier
Community Expert
Community Expert
January 20, 2023

You could use paragraph rules if the images are placed as anchored objects...

James Gifford—NitroPress
Legend
January 20, 2023

I thought of that, but it's only a half-step of "automation" with a fair amount of layout effort required.

 

There are any number of approaches to get IMAGE-LINE-IMAGE. But all those I can think of require it to be a largely manual process, with or without a little help from things such as paragraph and object styles.

 

brian_p_dts
Community Expert
Community Expert
January 20, 2023

You could find an anchored object insertion, then add a new paragraph with a paragraph rule style, with F/C

James Gifford—NitroPress
Legend
January 20, 2023

I'm not sure this can be done with any ID feature other than drawing a rule under each frame... which might be scriptable. The only features to add either a rule above/below, or a border that's zero on three sides, is in Paragraph Styles, so I am not sure there's anything to leverage there, either — it would have to be a script to draw a rule of X dimensions.

 

But maybe I'm missing something that would make it easier.