Created
July 12, 2010 08:04
-
-
Save osima/472236 to your computer and use it in GitHub Desktop.
狙った部分をxref要素としてXMLツリーに追加する, InDesign
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// 狙った部分をxref要素としてXMLツリーに追加する. | |
// InDesign CS5 | |
// | |
// テキストフレームが一つ存在する indd 文書を想定 | |
var doc = app.activeDocument; | |
var tf = doc.textFrames.firstItem() | |
// ルート要素を取得 | |
var eRoot = doc.xmlElements.itemByName("Root"); | |
// ルート要素に tf 要素を作成して追加 | |
var eTf = eRoot.xmlElements.add("tf",tf); | |
// テキストフレーム中の段落を取得 | |
var p = tf.paragraphs.item(0); | |
// 段落の先頭の範囲オブジェクトを生成 | |
var aInsertionPoint = p.insertionPoints.itemByRange(0,0); | |
// その部分を tf要素 に追加 | |
var eXref = eTf.xmlElements.add("xref", aInsertionPoint ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment