从选定的文本生成脚注
我正在尝试使用 ExtendScript 编写 InDesign 脚本。我希望脚本剪切选定的文本,插入脚注并将文本粘贴到脚注正文中。我尝试过的:
function makeFootnoteOfSelection(){
var fnText = app.activeDocument.selection[0];
// this should actually clone the selected text, not reference it, because the next statement zaps it from memory
app.activeDocument.selection[0].remove(); // works
var fNote = app.activeDocument.selection[0].footnotes.add(); // works, adds an empty footnote with a reference
fNote.contents = fnText.contents;
// this replaces the reference number, I was hoping to retain it and just add the text
// fNote.contents += fnText.contents; also replaces the reference number
}
I am trying to script InDesign using ExtendScript. I want the script to cut the selected text, insert a footnote and paste the text into the footnote body. What I have tried:
function makeFootnoteOfSelection(){
var fnText = app.activeDocument.selection[0];
// this should actually clone the selected text, not reference it, because the next statement zaps it from memory
app.activeDocument.selection[0].remove(); // works
var fNote = app.activeDocument.selection[0].footnotes.add(); // works, adds an empty footnote with a reference
fNote.contents = fnText.contents;
// this replaces the reference number, I was hoping to retain it and just add the text
// fNote.contents += fnText.contents; also replaces the reference number
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
InDesign CS5:
InDesign CS4:
InDesign CS5:
InDesign CS4: