ごんれのラボ

iOS、Android、Adobe系ソフトの自動化スクリプトのことを書き連ねています。

InDesignでJavaScript その12

InDesignでJavaScript その12。

これそれで書いたお仕事用のJavaScript。

公開するのをちょっと迷ったんだけど、こんな事やってます的な意味でアップしておきます。

(もしかしたら消去するかも…)

一応著作権は私にあるわけで、特に問題もないかなーということで。

これぐらいならちょっとかじれば誰でも書けるでしょ。

具体的な仕様については先日の日記をみてください。

念のため細かいことは説明を控えさせていただきます。

/*

★XML読み込み&コマ作成&いろいろ調整.jsx★

☆ver.1.0☆

Copyright [偽善者こうちゃん]

[2007.02.27] {

ver.1.0作成

}

お仕事モードで作成したJavaScript。

なお、このJavaScriptを使用して損害をこうむっても

私は知りませんので、あしからず。

偽善者こうちゃん

http://macneko.blog77.fc2.com/

*/

//DBファイルを決め打ち

var filename = "hogehoge.txt" ;

if (filename) {

fileObj = new File(filename);

//ファイルを読み込みモードで開く

flag = fileObj.open("r");

if (flag == true) {

//テキストの終わりまで{}の処理を続ける

while (!fileObj.eof) {

//ファイルを1行だけ読み込む

line = fileObj.readln();

//空行(改行のみ)じゃなかったら

if (line != "") {

var line = line.split(",") ;

app.open("tekito.indd") ;

docObj = app.activeDocument ;

//コマオブジェクトのグループごと選択して変数に入れる

docObj.pageItems[0].select() ;

var komaObj = app.selection[0] ;

//komaObj.label = "koma" + labelCount ; //何コマめかをラベルとして入れておく

//XMLファイルを読み込む関数へ

XMLimport() ;

//XMLタグからコマのテーマカラーのキーを取得する

var komaColor = docObj.xmlElements.item("Root").xmlElements.item("record").contents ;

//コマのテーマカラーを変更する関数_ライン版関数へ

StrokeColorChange() ;

//コマのテーマカラーを変更する関数_塗り版関数へ

FillColorChange() ;

//EL情報にスタイルを変更する関数へ

Joho() ;

//ここからフレーム縮小処理関数

FrameSize() ;

//オーバーフロー処理関数へ

FrameOverFlow() ;

//画像をフレームよりやや大きめに均等に配置する関数へ

ImageCenter() ;

//別名保存

docObj.save(line[1]) ;

app.activeDocument.close() ;

}

}

}

}

//以下、関数群

//XMLファイルを読み込む関数

function XMLimport() {

var myRootElement = docObj.xmlElements.item("Root") ;

myRootElement.importXML(line[0]) ;

}

//コマのテーマカラーを変更する関数_ライン版

function StrokeColorChange() {

komaObj.pageItems.item("sen").select() ;

var frameStrokeColor = app.selection[0] ;

frameStrokeColor.strokeColor = docObj.swatches.item(komaColor) ;

}

//コマのテーマカラーを変更する関数_塗り版

function FillColorChange() {

komaObj.pageItems.item("nuri1").select() ;

komaObj.pageItems.item("nuri2").select(SelectionOptions.addTo) ;

komaObj.pageItems.item("nuri3").select(SelectionOptions.addTo) ;

for (F = 0 ; F < app.selection.length ; F ++) {

var frameFillColor = app.selection[F] ;

frameFillColor.fillColor = docObj.swatches.item(komaColor) ;

}

}

//画像をフレームよりやや大きめに均等に配置する関数

function ImageCenter() {

//例によって選択

komaObj.pageItems.item("image").select() ;

var imageFrame = app.selection[0] ;

//ひとまず内容をフレームに合わせる

imageFrame.fit(FitOptions.contentToFrame) ;

//縦横の倍率を取得する

var imageHorScale = imageFrame.graphics[0].horizontalScale ;

var imageVerScale = imageFrame.graphics[0].verticalScale ;

//大きい方の倍率に合わせるための処理

if (imageHorScale != imageVerScale) { //縦横の倍率が違ったら

if (imageHorScale > imageVerScale) { //横の倍率が縦より大きかったら

//各々の倍率を横の倍率にする

imageFrame.graphics[0].horizontalScale = imageHorScale;

imageFrame.graphics[0].verticalScale = imageHorScale;

} else {

//各々の倍率を縦の倍率にする

imageFrame.graphics[0].horizontalScale = imageVerScale;

imageFrame.graphics[0].verticalScale = imageVerScale;

}

}

//フレーム内センターに配置

imageFrame.fit(FitOptions.centerContent) ;

}

//EL情報にスタイルを変更する関数

function Joho() {

komaObj.pageItems.item("season").select() ;

var seasonFrame = app.selection[0] ;

for (pl = 0 ; pl < seasonFrame.paragraphs.length ; pl ++) {

seasonFrame.paragraphs[pl].characters[0].select() ; //pl行の1文字目を選択

var seasonFrameText = app.selection[0].contents ; //選択した文字の内容を調べる

if (seasonFrameText.charCodeAt(0) == "9679") { //●だったら

seasonFrame.paragraphs[pl].appliedParagraphStyle = "EL情報" ;

}

}

}

//オーバーフロー処理関数

function FrameOverFlow() {

//オーバーフロー処理

for (i = 0 ; i < komaObj.pageItems.length ; i++) { //コマオブジェクトの中のオブジェクトの数だけ繰り返す

//コマオブジェクトの中のフレームを処理していくために変数に代入

komaObj.pageItems[i].select() ;

var komaFrame = app.selection[0] ;

if ( komaFrame.overflows == true) { //オーバーフローしていたら

if (komaFrame.label != "hedder") { //表組のフレーム以外だったら

if (komaFrame.label != "season") { //かつシーズン以外だったら

//フレームの座標を取得

//var komaFrame_y1 = komaFrame.geometricBounds[0];

var komaFrame_x1 = komaFrame.geometricBounds[1];

//var komaFrame_y2 = komaFrame.geometricBounds[2];

var komaFrame_x2 = komaFrame.geometricBounds[3];

var komaFrameSize_w = komaFrame_x2 - komaFrame_x1 ; //幅を取得

//var komaFrameSize_h = komaFrame_y2 - komaFrame_y1 ; //高さを取得

//長体処理

//フレーム内に複数行あったときのことを考えてfor文で処理

for (p = 0 ; p < komaFrame.paragraphs.length ; p ++) {

/* 文字組アキ量設定で設定したからコメントアウト

//前後アキ量を変更

for (c = 0 ; c < komaFrame.characters.length ; c ++) {

komaFrame.characters[c].select() ; //c文字めを選択

var komaFrameText = app.selection[0].contents ; //選択した文字の内容を調べる

//メモ下記内の文字だったら

if *1 {

//メモ書き

// 12300 「

// 12301 」

// 12302 『

// 12303 』

// 12304 【

// 12305 】

// 65288 (

// 65289 )

// 12539 ・

//前後アキ量をベタにする

komaFrame.characters[c].leadingAki = 0 ;

komaFrame.characters[c].trailingAki = 0 ;

}

}

*/

//フレーム内のp行めを選択

komaFrame.paragraphs[p].select();

app.copy() ; //コピー

//フレーム内から抜けるために元のフレームを選択しておく

//(ドキュメント上にペーストするため)

komaObj.pageItems[i].select(SelectionOptions.replace) ;

//ドキュメント上にペースト(勝手にフレームが作られる)して選択

app.paste() ;

docObj.pageItems[0].select() ;

var checkFrame = app.selection[0] ;

checkFrame.geometricBounds = ["0mm", "0mm", "100mm", "200mm"]

checkFrame.characters.lastItem().select() ; //ペーストした行の最後の文字を選択

var checkLastItem = app.selection[0].contents ; //最後の文字の内容を調べる

//最後の文字が改行なら

if (checkLastItem.charCodeAt(0) == "13") {

//カットする

app.cut() ;

}

//チェック用のフレームを内容に合わせてフィットする

checkFrame.fit(FitOptions.frameToContent) ;

//チェック用のフレームの座標を取得(オーバーフローしているフレームとの比較に使う)

//var checkFrame_y1 = checkFrame.geometricBounds[0];

var checkFrame_x1 = checkFrame.geometricBounds[1];

//var checkFrame_y2 = checkFrame.geometricBounds[2];

var checkFrame_x2 = checkFrame.geometricBounds[3];

if (komaFrame.label == "hyoseason") { //表組内シーズンだったら

var checkFrameSize_w = checkFrame_x2 - checkFrame_x1 + 1.1 ; //幅を取得(インデントを考慮。インデントよりやや大きめにする)

} else {

var checkFrameSize_w = checkFrame_x2 - checkFrame_x1 ; //幅を取得

}//var checkFrameSize_h = checkFrame_y2 - checkFrame_y1 ; //高さを取得

if (komaFrame.label == "hyoseason") { //表組内シーズンだったら

////長体率を計算(小数点切り下げ)。インデントを除外した数値で計算しないとダメ

var w = Math.floor(((komaFrameSize_w -1) / (checkFrameSize_w -1)) * 100)

} else {

////長体率を計算(小数点切り下げ)。インデントを除外した数値で計算しないとダメ

var w = Math.floor((komaFrameSize_w / checkFrameSize_w ) * 100)

}

checkFrame.remove() ; //チェック用のボックスを削除

if (w < 100) {

//すでに長体がかかっている場合を考慮して一旦長体率を求めてそれに計算した長体率をかける

komaFrame.paragraphs[p].horizontalScale = komaFrame.paragraphs[p].horizontalScale * (w / 100) ;

}

}

}

}

}

}

}

//ここからフレーム縮小処理関数

function FrameSize() {

//あらかじめ変数に入れておく

var rowHeight = 2.46944444444444 ; //行の高さ

var ColumnWidth = [12.5,68,34,22.67,17,13.6,11.34] ;

var cellCha = [] ;

//表組のボックスを選択

komaObj.pageItems.item("hyo").select() ;

var hyogumiFrame = app.selection[0] ;

//フレームの座標を取得

var hyogumiFrame_y1 = hyogumiFrame.geometricBounds[0];

var hyogumiFrame_x1 = hyogumiFrame.geometricBounds[1];

var hyogumiFrame_y2 = hyogumiFrame.geometricBounds[2];

var hyogumiFrame_x2 = hyogumiFrame.geometricBounds[3];

//var hyogumiFrameSize_w = hyogumiFrame_x2 - hyogumiFrame_x1 ; //幅を取得

//var hyogumiFrameSize_h = hyogumiFrame_y2 - hyogumiFrame_y1 ; //高さを取得

hyogumiFrame.tables[0].select() ;

var hyogumiSelection = app.selection[0] ;

var hyougumiRowSpan = hyogumiSelection.rowSpan ; //表組の行数を求める(表組を選択していない場合はbodyRowCount)

var hyougumiColumnSpan = hyogumiSelection.columnSpan ; //表組の列数を求める(表組を選択していない場合はcolumnCount)

//選択している表組のセルの数だけ繰り返し

for (cs = 1 ; cs < hyougumiColumnSpan ; cs ++) { //列数分繰り返し(1列目は空行でwidthも違うのでcs=1からスタート)

hyogumiSelection.columns[cs].select() ; //cs列を選択

app.selection[0].width = ColumnWidth[hyougumiColumnSpan - 1] ; //widthを変更

//セルのスタイルを文字数に応じて変える処理(センターにするか右揃えにするか)

for (rs = 0 ; rs < hyougumiRowSpan ; rs ++) {

hyogumiSelection.columns[cs].cells[rs].select() ;

var cellChaLen = app.selection[0].characters.length ; //セルの文字数を数える

cellCha[rs] = cellChaLen ; //行数分、配列に代入

}

//セルの文字数で処理を分ける

switch (cellCha.length) {

case 7 : //7行パターン

if (cellCha[1] == cellCha[2]) { //2行目と3行目の文字数が一緒なら

if (cellCha[1] == 1) { //2行目の文字数が1なら(─だったら)

for (rs = 0 ; rs < hyougumiRowSpan ; rs ++) {

hyogumiSelection.columns[cs].cells[rs].select() ;

app.selection[0].insertionPoints[0].appliedParagraphStyle = "EL料金表列センター" ;

}

} else if (cellCha[2] == 1) {

for (rs = 0 ; rs < hyougumiRowSpan ; rs ++) {

hyogumiSelection.columns[cs].cells[rs].select() ;

app.selection[0].insertionPoints[0].appliedParagraphStyle = "EL料金表列センター" ;

}

} else if (cellCha[3] == 1) {

for (rs = 0 ; rs < hyougumiRowSpan ; rs ++) {

hyogumiSelection.columns[cs].cells[rs].select() ;

app.selection[0].insertionPoints[0].appliedParagraphStyle = "EL料金表列センター" ;

}

} else if (cellCha[4] == 1) {

for (rs = 0 ; rs < hyougumiRowSpan ; rs ++) {

hyogumiSelection.columns[cs].cells[rs].select() ;

app.selection[0].insertionPoints[0].appliedParagraphStyle = "EL料金表列センター" ;

}

} else if (cellCha[5] == 1) {

for (rs = 0 ; rs < hyougumiRowSpan ; rs ++) {

hyogumiSelection.columns[cs].cells[rs].select() ;

app.selection[0].insertionPoints[0].appliedParagraphStyle = "EL料金表列センター" ;

}

} else if (cellCha[6] == 1) {

for (rs = 0 ; rs < hyougumiRowSpan ; rs ++) {

hyogumiSelection.columns[cs].cells[rs].select() ;

app.selection[0].insertionPoints[0].appliedParagraphStyle = "EL料金表列センター" ;

}

} else if (cellCha[1] == cellCha[3]) {

if (cellCha[1] == 1) {

for (rs = 0 ; rs < hyougumiRowSpan ; rs ++) {

hyogumiSelection.columns[cs].cells[rs].select() ;

app.selection[0].insertionPoints[0].appliedParagraphStyle = "EL料金表列センター" ;

}

} else if (cellCha[2] == 1) {

for (rs = 0 ; rs < hyougumiRowSpan ; rs ++) {

hyogumiSelection.columns[cs].cells[rs].select() ;

app.selection[0].insertionPoints[0].appliedParagraphStyle = "EL料金表列センター" ;

}

} else if (cellCha[3] == 1) {

for (rs = 0 ; rs < hyougumiRowSpan ; rs ++) {

hyogumiSelection.columns[cs].cells[rs].select() ;

app.selection[0].insertionPoints[0].appliedParagraphStyle = "EL料金表列センター" ;

}

} else if (cellCha[4] == 1) {

for (rs = 0 ; rs < hyougumiRowSpan ; rs ++) {

hyogumiSelection.columns[cs].cells[rs].select() ;

app.selection[0].insertionPoints[0].appliedParagraphStyle = "EL料金表列センター" ;

}

} else if (cellCha[5] == 1) {

for (rs = 0 ; rs < hyougumiRowSpan ; rs ++) {

hyogumiSelection.columns[cs].cells[rs].select() ;

app.selection[0].insertionPoints[0].appliedParagraphStyle = "EL料金表列センター" ;

}

} else if (cellCha[6] == 1) {

for (rs = 0 ; rs < hyougumiRowSpan ; rs ++) {

hyogumiSelection.columns[cs].cells[rs].select() ;

app.selection[0].insertionPoints[0].appliedParagraphStyle = "EL料金表列センター" ;

}

} else if (cellCha[1] == cellCha[4]) {

if (cellCha[1] == 1) {

for (rs = 0 ; rs < hyougumiRowSpan ; rs ++) {

hyogumiSelection.columns[cs].cells[rs].select() ;

app.selection[0].insertionPoints[0].appliedParagraphStyle = "EL料金表列センター" ;

}

} else if (cellCha[2] == 1) {

for (rs = 0 ; rs < hyougumiRowSpan ; rs ++) {

hyogumiSelection.columns[cs].cells[rs].select() ;

app.selection[0].insertionPoints[0].appliedParagraphStyle = "EL料金表列センター" ;

}

} else if (cellCha[3] == 1) {

for (rs = 0 ; rs < hyougumiRowSpan ; rs ++) {

hyogumiSelection.columns[cs].cells[rs].select() ;

app.selection[0].insertionPoints[0].appliedParagraphStyle = "EL料金表列センター" ;

}

} else if (cellCha[4] == 1) {

for (rs = 0 ; rs < hyougumiRowSpan ; rs ++) {

hyogumiSelection.columns[cs].cells[rs].select() ;

app.selection[0].insertionPoints[0].appliedParagraphStyle = "EL料金表列センター" ;

}

} else if (cellCha[5] == 1) {

for (rs = 0 ; rs < hyougumiRowSpan ; rs ++) {

hyogumiSelection.columns[cs].cells[rs].select() ;

app.selection[0].insertionPoints[0].appliedParagraphStyle = "EL料金表列センター" ;

}

} else if (cellCha[6] == 1) {

for (rs = 0 ; rs < hyougumiRowSpan ; rs ++) {

hyogumiSelection.columns[cs].cells[rs].select() ;

app.selection[0].insertionPoints[0].appliedParagraphStyle = "EL料金表列センター" ;

}

} else if (cellCha[1] == cellCha[5]) {

if (cellCha[1] == 1) {

for (rs = 0 ; rs < hyougumiRowSpan ; rs ++) {

hyogumiSelection.columns[cs].cells[rs].select() ;

app.selection[0].insertionPoints[0].appliedParagraphStyle = "EL料金表列センター" ;

}

} else if (cellCha[2] == 1) {

for (rs = 0 ; rs < hyougumiRowSpan ; rs ++) {

hyogumiSelection.columns[cs].cells[rs].select() ;

app.selection[0].insertionPoints[0].appliedParagraphStyle = "EL料金表列センター" ;

}

} else if (cellCha[3] == 1) {

for (rs = 0 ; rs < hyougumiRowSpan ; rs ++) {

hyogumiSelection.columns[cs].cells[rs].select() ;

app.selection[0].insertionPoints[0].appliedParagraphStyle = "EL料金表列センター" ;

}

} else if (cellCha[4] == 1) {

for (rs = 0 ; rs < hyougumiRowSpan ; rs ++) {

hyogumiSelection.columns[cs].cells[rs].select() ;

app.selection[0].insertionPoints[0].appliedParagraphStyle = "EL料金表列センター" ;

}

} else if (cellCha[5] == 1) {

for (rs = 0 ; rs < hyougumiRowSpan ; rs ++) {

hyogumiSelection.columns[cs].cells[rs].select() ;

app.selection[0].insertionPoints[0].appliedParagraphStyle = "EL料金表列センター" ;

}

} else if (cellCha[6] == 1) {

for (rs = 0 ; rs < hyougumiRowSpan ; rs ++) {

hyogumiSelection.columns[cs].cells[rs].select() ;

app.selection[0].insertionPoints[0].appliedParagraphStyle = "EL料金表列センター" ;

}

} else if (cellCha[1] == cellCha[6]) {

for (rs = 0 ; rs < hyougumiRowSpan ; rs ++) {

hyogumiSelection.columns[cs].cells[rs].select() ;

app.selection[0].insertionPoints[0].appliedParagraphStyle = "EL料金表列センター" ;

}

} else { //cellCha[1] == cellCha[6]じゃなかったら

for (rs = 0 ; rs < hyougumiRowSpan ; rs ++) {

hyogumiSelection.columns[cs].cells[rs].select() ;

app.selection[0].insertionPoints[0].appliedParagraphStyle = "EL料金表" + (hyougumiColumnSpan) + "列" ;

}

}

} else { //cellCha[1] == cellCha[5]じゃなかったら

for (rs = 0 ; rs < hyougumiRowSpan ; rs ++) {

hyogumiSelection.columns[cs].cells[rs].select() ;

app.selection[0].insertionPoints[0].appliedParagraphStyle = "EL料金表" + (hyougumiColumnSpan) + "列" ;

}

}

} else { //cellCha[1] == cellCha[4]じゃなかったら

for (rs = 0 ; rs < hyougumiRowSpan ; rs ++) {

hyogumiSelection.columns[cs].cells[rs].select() ;

app.selection[0].insertionPoints[0].appliedParagraphStyle = "EL料金表" + (hyougumiColumnSpan) + "列" ;

}

}

} else { //cellCha[1] == cellCha[3]じゃなかったら

for (rs = 0 ; rs < hyougumiRowSpan ; rs ++) {

hyogumiSelection.columns[cs].cells[rs].select() ;

app.selection[0].insertionPoints[0].appliedParagraphStyle = "EL料金表" + (hyougumiColumnSpan) + "列" ;

}

}

} else if (cellCha[1] == 1) {

for (rs = 0 ; rs < hyougumiRowSpan ; rs ++) {

hyogumiSelection.columns[cs].cells[rs].select() ;

app.selection[0].insertionPoints[0].appliedParagraphStyle = "EL料金表列センター" ;

}

} else if (cellCha[2] == 1) {

for (rs = 0 ; rs < hyougumiRowSpan ; rs ++) {

hyogumiSelection.columns[cs].cells[rs].select() ;

app.selection[0].insertionPoints[0].appliedParagraphStyle = "EL料金表列センター" ;

}

} else { //cellCha[1] == cellCha[2]じゃなかったら

for (rs = 0 ; rs < hyougumiRowSpan ; rs ++) {

hyogumiSelection.columns[cs].cells[rs].select() ;

app.selection[0].insertionPoints[0].appliedParagraphStyle = "EL料金表" + (hyougumiColumnSpan) + "列" ;

}

}

break ;

case 6 :

if (cellCha[1] == cellCha[2]) {

if (cellCha[1] == 1) {

for (rs = 0 ; rs < hyougumiRowSpan ; rs ++) {

hyogumiSelection.columns[cs].cells[rs].select() ;

app.selection[0].insertionPoints[0].appliedParagraphStyle = "EL料金表列センター" ;

}

} else if (cellCha[2] == 1) {

for (rs = 0 ; rs < hyougumiRowSpan ; rs ++) {

hyogumiSelection.columns[cs].cells[rs].select() ;

app.selection[0].insertionPoints[0].appliedParagraphStyle = "EL料金表列センター" ;

}

} else if (cellCha[3] == 1) {

for (rs = 0 ; rs < hyougumiRowSpan ; rs ++) {

hyogumiSelection.columns[cs].cells[rs].select() ;

app.selection[0].insertionPoints[0].appliedParagraphStyle = "EL料金表列センター" ;

}

} else if (cellCha[4] == 1) {

for (rs = 0 ; rs < hyougumiRowSpan ; rs ++) {

hyogumiSelection.columns[cs].cells[rs].select() ;

app.selection[0].insertionPoints[0].appliedParagraphStyle = "EL料金表列センター" ;

}

} else if (cellCha[5] == 1) {

for (rs = 0 ; rs < hyougumiRowSpan ; rs ++) {

hyogumiSelection.columns[cs].cells[rs].select() ;

app.selection[0].insertionPoints[0].appliedParagraphStyle = "EL料金表列センター" ;

}

} else if (cellCha[6] == 1) {

for (rs = 0 ; rs < hyougumiRowSpan ; rs ++) {

hyogumiSelection.columns[cs].cells[rs].select() ;

app.selection[0].insertionPoints[0].appliedParagraphStyle = "EL料金表列センター" ;

}

} else if (cellCha[1] == cellCha[3]) {

if (cellCha[1] == 1) {

for (rs = 0 ; rs < hyougumiRowSpan ; rs ++) {

hyogumiSelection.columns[cs].cells[rs].select() ;

app.selection[0].insertionPoints[0].appliedParagraphStyle = "EL料金表列センター" ;

}

} else if (cellCha[2] == 1) {

for (rs = 0 ; rs < hyougumiRowSpan ; rs ++) {

hyogumiSelection.columns[cs].cells[rs].select() ;

app.selection[0].insertionPoints[0].appliedParagraphStyle = "EL料金表列センター" ;

}

} else if (cellCha[3] == 1) {

for (rs = 0 ; rs < hyougumiRowSpan ; rs ++) {

hyogumiSelection.columns[cs].cells[rs].select() ;

app.selection[0].insertionPoints[0].appliedParagraphStyle = "EL料金表列センター" ;

}

} else if (cellCha[4] == 1) {

for (rs = 0 ; rs < hyougumiRowSpan ; rs ++) {

hyogumiSelection.columns[cs].cells[rs].select() ;

app.selection[0].insertionPoints[0].appliedParagraphStyle = "EL料金表列センター" ;

}

} else if (cellCha[5] == 1) {

for (rs = 0 ; rs < hyougumiRowSpan ; rs ++) {

hyogumiSelection.columns[cs].cells[rs].select() ;

app.selection[0].insertionPoints[0].appliedParagraphStyle = "EL料金表列センター" ;

}

} else if (cellCha[6] == 1) {

for (rs = 0 ; rs < hyougumiRowSpan ; rs ++) {

hyogumiSelection.columns[cs].cells[rs].select() ;

app.selection[0].insertionPoints[0].appliedParagraphStyle = "EL料金表列センター" ;

}

} else if (cellCha[1] == cellCha[4]) {

if (cellCha[1] == 1) {

for (rs = 0 ; rs < hyougumiRowSpan ; rs ++) {

hyogumiSelection.columns[cs].cells[rs].select() ;

app.selection[0].insertionPoints[0].appliedParagraphStyle = "EL料金表列センター" ;

}

} else if (cellCha[2] == 1) {

for (rs = 0 ; rs < hyougumiRowSpan ; rs ++) {

hyogumiSelection.columns[cs].cells[rs].select() ;

app.selection[0].insertionPoints[0].appliedParagraphStyle = "EL料金表列センター" ;

}

} else if (cellCha[3] == 1) {

for (rs = 0 ; rs < hyougumiRowSpan ; rs ++) {

hyogumiSelection.columns[cs].cells[rs].select() ;

app.selection[0].insertionPoints[0].appliedParagraphStyle = "EL料金表列センター" ;

}

} else if (cellCha[4] == 1) {

for (rs = 0 ; rs < hyougumiRowSpan ; rs ++) {

hyogumiSelection.columns[cs].cells[rs].select() ;

app.selection[0].insertionPoints[0].appliedParagraphStyle = "EL料金表列センター" ;

}

} else if (cellCha[5] == 1) {

for (rs = 0 ; rs < hyougumiRowSpan ; rs ++) {

hyogumiSelection.columns[cs].cells[rs].select() ;

app.selection[0].insertionPoints[0].appliedParagraphStyle = "EL料金表列センター" ;

}

} else if (cellCha[6] == 1) {

for (rs = 0 ; rs < hyougumiRowSpan ; rs ++) {

hyogumiSelection.columns[cs].cells[rs].select() ;

app.selection[0].insertionPoints[0].appliedParagraphStyle = "EL料金表列センター" ;

}

} else if (cellCha[1] == cellCha[5]) {

for (rs = 0 ; rs < hyougumiRowSpan ; rs ++) {

hyogumiSelection.columns[cs].cells[rs].select() ;

app.selection[0].insertionPoints[0].appliedParagraphStyle = "EL料金表列センター" ;

}

} else { //cellCha[1] == cellCha[5]じゃなかったら

for (rs = 0 ; rs < hyougumiRowSpan ; rs ++) {

hyogumiSelection.columns[cs].cells[rs].select() ;

app.selection[0].insertionPoints[0].appliedParagraphStyle = "EL料金表" + (hyougumiColumnSpan) + "列" ;

}

}

} else { //cellCha[1] == cellCha[4]じゃなかったら

for (rs = 0 ; rs < hyougumiRowSpan ; rs ++) {

hyogumiSelection.columns[cs].cells[rs].select() ;

app.selection[0].insertionPoints[0].appliedParagraphStyle = "EL料金表" + (hyougumiColumnSpan) + "列" ;

}

}

} else { //cellCha[1] == cellCha[3]じゃなかったら

for (rs = 0 ; rs < hyougumiRowSpan ; rs ++) {

hyogumiSelection.columns[cs].cells[rs].select() ;

app.selection[0].insertionPoints[0].appliedParagraphStyle = "EL料金表" + (hyougumiColumnSpan) + "列" ;

}

}

} else if (cellCha[1] == 1) {

for (rs = 0 ; rs < hyougumiRowSpan ; rs ++) {

hyogumiSelection.columns[cs].cells[rs].select() ;

app.selection[0].insertionPoints[0].appliedParagraphStyle = "EL料金表列センター" ;

}

} else if (cellCha[2] == 1) {

for (rs = 0 ; rs < hyougumiRowSpan ; rs ++) {

hyogumiSelection.columns[cs].cells[rs].select() ;

app.selection[0].insertionPoints[0].appliedParagraphStyle = "EL料金表列センター" ;

}

} else { //cellCha[1] == cellCha[2]じゃなかったら

for (rs = 0 ; rs < hyougumiRowSpan ; rs ++) {

hyogumiSelection.columns[cs].cells[rs].select() ;

app.selection[0].insertionPoints[0].appliedParagraphStyle = "EL料金表" + (hyougumiColumnSpan) + "列" ;

}

}

break ;

case 5 :

if (cellCha[1] == cellCha[2]) {

if (cellCha[1] == 1) {

for (rs = 0 ; rs < hyougumiRowSpan ; rs ++) {

hyogumiSelection.columns[cs].cells[rs].select() ;

app.selection[0].insertionPoints[0].appliedParagraphStyle = "EL料金表列センター" ;

}

} else if (cellCha[2] == 1) {

for (rs = 0 ; rs < hyougumiRowSpan ; rs ++) {

hyogumiSelection.columns[cs].cells[rs].select() ;

app.selection[0].insertionPoints[0].appliedParagraphStyle = "EL料金表列センター" ;

}

} else if (cellCha[3] == 1) {

for (rs = 0 ; rs < hyougumiRowSpan ; rs ++) {

hyogumiSelection.columns[cs].cells[rs].select() ;

app.selection[0].insertionPoints[0].appliedParagraphStyle = "EL料金表列センター" ;

}

} else if (cellCha[4] == 1) {

for (rs = 0 ; rs < hyougumiRowSpan ; rs ++) {

hyogumiSelection.columns[cs].cells[rs].select() ;

app.selection[0].insertionPoints[0].appliedParagraphStyle = "EL料金表列センター" ;

}

} else if (cellCha[5] == 1) {

for (rs = 0 ; rs < hyougumiRowSpan ; rs ++) {

hyogumiSelection.columns[cs].cells[rs].select() ;

app.selection[0].insertionPoints[0].appliedParagraphStyle = "EL料金表列センター" ;

}

} else if (cellCha[6] == 1) {

for (rs = 0 ; rs < hyougumiRowSpan ; rs ++) {

hyogumiSelection.columns[cs].cells[rs].select() ;

app.selection[0].insertionPoints[0].appliedParagraphStyle = "EL料金表列センター" ;

}

} else if (cellCha[1] == cellCha[3]) {

if (cellCha[1] == 1) {

for (rs = 0 ; rs < hyougumiRowSpan ; rs ++) {

hyogumiSelection.columns[cs].cells[rs].select() ;

app.selection[0].insertionPoints[0].appliedParagraphStyle = "EL料金表列センター" ;

}

} else if (cellCha[2] == 1) {

for (rs = 0 ; rs < hyougumiRowSpan ; rs ++) {

hyogumiSelection.columns[cs].cells[rs].select() ;

app.selection[0].insertionPoints[0].appliedParagraphStyle = "EL料金表列センター" ;

}

} else if (cellCha[3] == 1) {

for (rs = 0 ; rs < hyougumiRowSpan ; rs ++) {

hyogumiSelection.columns[cs].cells[rs].select() ;

app.selection[0].insertionPoints[0].appliedParagraphStyle = "EL料金表列センター" ;

}

} else if (cellCha[4] == 1) {

for (rs = 0 ; rs < hyougumiRowSpan ; rs ++) {

hyogumiSelection.columns[cs].cells[rs].select() ;

app.selection[0].insertionPoints[0].appliedParagraphStyle = "EL料金表列センター" ;

}

} else if (cellCha[5] == 1) {

for (rs = 0 ; rs < hyougumiRowSpan ; rs ++) {

hyogumiSelection.columns[cs].cells[rs].select() ;

app.selection[0].insertionPoints[0].appliedParagraphStyle = "EL料金表列センター" ;

}

} else if (cellCha[6] == 1) {

for (rs = 0 ; rs < hyougumiRowSpan ; rs ++) {

hyogumiSelection.columns[cs].cells[rs].select() ;

app.selection[0].insertionPoints[0].appliedParagraphStyle = "EL料金表列センター" ;

}

} else if (cellCha[1] == cellCha[4]) {

for (rs = 0 ; rs < hyougumiRowSpan ; rs ++) {

hyogumiSelection.columns[cs].cells[rs].select() ;

app.selection[0].insertionPoints[0].appliedParagraphStyle = "EL料金表列センター" ;

}

} else { //cellCha[1] == cellCha[4]じゃなかったら

for (rs = 0 ; rs < hyougumiRowSpan ; rs ++) {

hyogumiSelection.columns[cs].cells[rs].select() ;

app.selection[0].insertionPoints[0].appliedParagraphStyle = "EL料金表" + (hyougumiColumnSpan) + "列" ;

}

}

} else { //cellCha[1] == cellCha[3]じゃなかったら

for (rs = 0 ; rs < hyougumiRowSpan ; rs ++) {

hyogumiSelection.columns[cs].cells[rs].select() ;

app.selection[0].insertionPoints[0].appliedParagraphStyle = "EL料金表" + (hyougumiColumnSpan) + "列" ;

}

}

} else if (cellCha[1] == 1) {

for (rs = 0 ; rs < hyougumiRowSpan ; rs ++) {

hyogumiSelection.columns[cs].cells[rs].select() ;

app.selection[0].insertionPoints[0].appliedParagraphStyle = "EL料金表列センター" ;

}

} else if (cellCha[2] == 1) {

for (rs = 0 ; rs < hyougumiRowSpan ; rs ++) {

hyogumiSelection.columns[cs].cells[rs].select() ;

app.selection[0].insertionPoints[0].appliedParagraphStyle = "EL料金表列センター" ;

}

} else { //cellCha[1] == cellCha[2]じゃなかったら

for (rs = 0 ; rs < hyougumiRowSpan ; rs ++) {

hyogumiSelection.columns[cs].cells[rs].select() ;

app.selection[0].insertionPoints[0].appliedParagraphStyle = "EL料金表" + (hyougumiColumnSpan) + "列" ;

}

}

break ;

case 4 :

if (cellCha[1] == cellCha[2]) {

if (cellCha[1] == 1) {

for (rs = 0 ; rs < hyougumiRowSpan ; rs ++) {

hyogumiSelection.columns[cs].cells[rs].select() ;

app.selection[0].insertionPoints[0].appliedParagraphStyle = "EL料金表列センター" ;

}

} else if (cellCha[2] == 1) {

for (rs = 0 ; rs < hyougumiRowSpan ; rs ++) {

hyogumiSelection.columns[cs].cells[rs].select() ;

app.selection[0].insertionPoints[0].appliedParagraphStyle = "EL料金表列センター" ;

}

} else if (cellCha[3] == 1) {

for (rs = 0 ; rs < hyougumiRowSpan ; rs ++) {

hyogumiSelection.columns[cs].cells[rs].select() ;

app.selection[0].insertionPoints[0].appliedParagraphStyle = "EL料金表列センター" ;

}

} else if (cellCha[4] == 1) {

for (rs = 0 ; rs < hyougumiRowSpan ; rs ++) {

hyogumiSelection.columns[cs].cells[rs].select() ;

app.selection[0].insertionPoints[0].appliedParagraphStyle = "EL料金表列センター" ;

}

} else if (cellCha[5] == 1) {

for (rs = 0 ; rs < hyougumiRowSpan ; rs ++) {

hyogumiSelection.columns[cs].cells[rs].select() ;

app.selection[0].insertionPoints[0].appliedParagraphStyle = "EL料金表列センター" ;

}

} else if (cellCha[6] == 1) {

for (rs = 0 ; rs < hyougumiRowSpan ; rs ++) {

hyogumiSelection.columns[cs].cells[rs].select() ;

app.selection[0].insertionPoints[0].appliedParagraphStyle = "EL料金表列センター" ;

}

} else if (cellCha[1] == cellCha[3]) {

for (rs = 0 ; rs < hyougumiRowSpan ; rs ++) {

hyogumiSelection.columns[cs].cells[rs].select() ;

app.selection[0].insertionPoints[0].appliedParagraphStyle = "EL料金表列センター" ;

}

} else { //cellCha[1] == cellCha[3]じゃなかったら

for (rs = 0 ; rs < hyougumiRowSpan ; rs ++) {

hyogumiSelection.columns[cs].cells[rs].select() ;

app.selection[0].insertionPoints[0].appliedParagraphStyle = "EL料金表" + (hyougumiColumnSpan) + "列" ;

}

}

} else if (cellCha[1] == 1) {

for (rs = 0 ; rs < hyougumiRowSpan ; rs ++) {

hyogumiSelection.columns[cs].cells[rs].select() ;

app.selection[0].insertionPoints[0].appliedParagraphStyle = "EL料金表列センター" ;

}

} else if (cellCha[2] == 1) {

for (rs = 0 ; rs < hyougumiRowSpan ; rs ++) {

hyogumiSelection.columns[cs].cells[rs].select() ;

app.selection[0].insertionPoints[0].appliedParagraphStyle = "EL料金表列センター" ;

}

} else { //cellCha[1] == cellCha[2]じゃなかったら

for (rs = 0 ; rs < hyougumiRowSpan ; rs ++) {

hyogumiSelection.columns[cs].cells[rs].select() ;

app.selection[0].insertionPoints[0].appliedParagraphStyle = "EL料金表" + (hyougumiColumnSpan) + "列" ;

}

}

break ;

case 3 :

if (cellCha[1] == cellCha[2]) {

for (rs = 0 ; rs < hyougumiRowSpan ; rs ++) {

hyogumiSelection.columns[cs].cells[rs].select() ;

app.selection[0].insertionPoints[0].appliedParagraphStyle = "EL料金表列センター" ;

}

} else if (cellCha[1] == 1) {

for (rs = 0 ; rs < hyougumiRowSpan ; rs ++) {

hyogumiSelection.columns[cs].cells[rs].select() ;

app.selection[0].insertionPoints[0].appliedParagraphStyle = "EL料金表列センター" ;

}

} else if (cellCha[2] == 1) {

for (rs = 0 ; rs < hyougumiRowSpan ; rs ++) {

hyogumiSelection.columns[cs].cells[rs].select() ;

app.selection[0].insertionPoints[0].appliedParagraphStyle = "EL料金表列センター" ;

}

} else { //cellCha[1] == cellCha[2]じゃなかったら

for (rs = 0 ; rs < hyougumiRowSpan ; rs ++) {

hyogumiSelection.columns[cs].cells[rs].select() ;

app.selection[0].insertionPoints[0].appliedParagraphStyle = "EL料金表" + (hyougumiColumnSpan) + "列" ;

}

}

break ;

case 2 :

for (rs = 0 ; rs < hyougumiRowSpan ; rs ++) {

hyogumiSelection.columns[cs].cells[rs].select() ;

app.selection[0].insertionPoints[0].appliedParagraphStyle = "EL料金表列センター" ;

}

}

}

//ヘッダーのスタイルを変更

komaObj.pageItems.item("hedder").select() ;

app.selection[0].insertionPoints[0].appliedParagraphStyle = "EL料金表ヘッダー" + (hyougumiColumnSpan) + "列" ;

//表組のフレームの高さを変更

var hyogumiHeight = (rowHeight * hyougumiRowSpan) + 0.1 ; //表組の高さを計算(0.1は囲み罫の太さ)

//座標を変更(サイズを変更)

hyogumiFrame.geometricBounds = [hyogumiFrame_y1, hyogumiFrame_x1, hyogumiFrame_y1 + hyogumiHeight, hyogumiFrame_x2] ;

//人数のフレームの高さを変更

//例によってフレームを選択

komaObj.pageItems.item("ninzu").select() ;

var ninzuFrame = app.selection[0] ;

//人数のフレームの座標を取得

var ninzuFrame_y1 = ninzuFrame.geometricBounds[0];

var ninzuFrame_x1 = ninzuFrame.geometricBounds[1];

var ninzuFrame_y2 = ninzuFrame.geometricBounds[2];

var ninzuFrame_x2 = ninzuFrame.geometricBounds[3];

ninzuFrame.geometricBounds = [ninzuFrame_y1, ninzuFrame_x1, ninzuFrame_y1 + hyogumiHeight - 0.1, ninzuFrame_x2] ;

//表内のシーズンのフレームの高さを変更

//例によってフレームを選択

komaObj.pageItems.item("hyoseason").select() ;

var hyoseasonFrame = app.selection[0] ;

//表内のシーズンのフレームの座標を取得

var hyoseasonFrame_y1 = hyoseasonFrame.geometricBounds[0];

var hyoseasonFrame_x1 = hyoseasonFrame.geometricBounds[1];

var hyoseasonFrame_y2 = hyoseasonFrame.geometricBounds[2];

var hyoseasonFrame_x2 = hyoseasonFrame.geometricBounds[3];

hyoseasonFrame.geometricBounds = [hyoseasonFrame_y1, hyoseasonFrame_x1, hyoseasonFrame_y1 + hyogumiHeight - rowHeight, hyoseasonFrame_x2] ;

//表組の行数が6より大きいときの処理

if (hyougumiRowSpan > 6) {

//シーズンのフレームの高さを変更

//例によってフレームを選択

komaObj.pageItems.item("season").select() ;

var seasonFrame = app.selection[0] ;

//シーズンのフレームの座標を取得

var seasonFrame_y1 = seasonFrame.geometricBounds[0];

var seasonFrame_x1 = seasonFrame.geometricBounds[1];

var seasonFrame_y2 = seasonFrame.geometricBounds[2];

var seasonFrame_x2 = seasonFrame.geometricBounds[3];

seasonFrame.geometricBounds = [seasonFrame_y1, seasonFrame_x1, 31.531, seasonFrame_x2] ;

//画像フレームの高さを変更

//例によってフレームを選択

komaObj.pageItems.item("image").select() ;

var ImageFrame = app.selection[0] ;

//画像フレームの座標を取得

var ImageFrame_y1 = ImageFrame.geometricBounds[0];

var ImageFrame_x1 = ImageFrame.geometricBounds[1];

var ImageFrame_y2 = ImageFrame.geometricBounds[2];

var ImageFrame_x2 = ImageFrame.geometricBounds[3];

ImageFrame.geometricBounds = [ImageFrame_y1, ImageFrame_x1, 31.531, ImageFrame_x2] ;

//表組を移動

hyogumiFrame.move("by", [0, 0 - rowHeight]) ;

//表組ヘッダーを移動

komaObj.pageItems.item("hedder").select() ;

var hedderFrame = app.selection[0] ;

hedderFrame.move("by", [0, 0 - rowHeight]) ;

//表組シーズンを移動

hyoseasonFrame.move("by", [0, 0 - rowHeight]) ;

//表組人数を移動

ninzuFrame.move("by", [0, 0 - rowHeight]) ;

//お一人様を移動

komaObj.pageItems.item("ohitori").select() ;

var ohitoriFrame = app.selection[0] ;

ohitoriFrame.move("by", [0, 0 - rowHeight]) ;

}

}

*1:komaFrameText.charCodeAt(0) == "12300") || (komaFrameText.charCodeAt(0) == "12301") || (komaFrameText.charCodeAt(0) == "12302") || (komaFrameText.charCodeAt(0) == "12303") || (komaFrameText.charCodeAt(0) == "12304") || (komaFrameText.charCodeAt(0) == "12305") || (komaFrameText.charCodeAt(0) == "65288") || (komaFrameText.charCodeAt(0) == "65289") || (komaFrameText.charCodeAt(0) == "12539"