[InDesign JavaScript] 選択しているアイテムを整列させる(オブジェクトの分布 編)

例(水平方向中央を基準に分布、マージンに揃える)


app.activeDocument.distribute(app.activeDocument.selection,DistributeOptions.HORIZONTAL_SPACE,AlignDistributeBounds.MARGIN_BOUNDS,false);


distribute(
 ItemObject,
 DistributeOpsions
 [,
  AlignDistributeBounds,
  useDistributeMeasurement,
  absoluteDistributeMeasurement
 ]
)


[DistributeOptions]
DistributeOptions.BOTTOM_EDGES //下端を基準に分布
DistributeOptions.HORIZONTAL_CENTERS //水平方向中央を基準に分布
DistributeOptions.LEFT_EDGES //左端を基準に分布
DistributeOptions.RIGHT_EDGES //右端を基準に分布
DistributeOptions.TOP_EDGES //上端を基準に分布
DistributeOptions.VERTICAL_CENTERS //垂直方向中央を基準に分布


[AlignDistributeBounds]
AlignDistributeBounds.ITEM_BOUNDS //選択範囲に揃える
AlignDistributeBounds.MARGIN_BOUNDS //マージンに揃える
AlignDistributeBounds.PAGE_BOUNDS //ページに揃える
AlignDistributeBounds.SPREAD_BOUNDS //スプレッドに揃える


[useDistributeMeasurement]
true //間隔指定を使う
false //間隔指定を使わない


[absoluteDistributeMeasurement]
間隔指定の数値


※3つ目以降のオプションは無くても動きます。無い場合は現在パレット上で選択されているオプションで動作します。