0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

InDesign 行のセルスタイルをセルの内容で統一する

Last updated at Posted at 2025-02-20

セルスタイルを統一したいセルにInsertionPoint(点滅する縦の線)がある状態で実行して下さい。

例えば
テーブルでカレンダーが作ってある場合に
InsertionPointのあるセルの内容が「日曜日」の場合
同じ内容のセルがある行に対して同様のセルスタイルが当てられます。

if(app.activeDocument.selection[0].constructor.name == "InsertionPoint" &&
    app.activeDocument.selection[0].parent.constructor.name == "Cell" &&
	app.activeDocument.selection[0].parent.parent.constructor.name == "Table"
){
	var targetCell = app.activeDocument.selection[0].parent;
	var targetTable = targetCell.parent;
	var count = 0;
	for(var i = 0; i < targetTable.rows.count(); i++){
		var nowRow = targetTable.rows.item(i);
		for(var ii = 0; ii < nowRow.cells.count(); ii++){
		    var nowCell = nowRow.cells.item(ii);
			if(nowCell.contents == targetCell.contents){
				for(var iii = 0; iii < nowRow.cells.count(); iii++){
					nowRow.cells.item(iii).appliedCellStyle = targetCell.appliedCellStyle;
					count++;
				}
				break;
			}
		}
	}
	alert("changeCellStyle : " + count);
}

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?