以下InDesign(Java)脚本不会更改所有段落的文本内容和格式: -
for (var j = 0; j < app.activeDocument.stories.length; j++) {
for (var k = 0; k < app.activeDocument.stories.item(j).paragraphs.length; k++) {
var myText = app.activeDocument.stories.item(j).paragraphs.item(k);
myText.contents = C2Unic(myText.contents, myText.appliedFont.fontFamily);
myText.appliedFont = app.fonts.item("Mangal");
myText.pointSize = myText.pointSize*0.878;
myText.composer="Adobe World-Ready Paragraph Composer";
}
}
在下图中注意粉红色背景的内容。所有这些都有源格式。发生了什么事?
答案 0 :(得分:2)
这可能不是解决方案,但有时在修改contents
时有助于循环翻阅段落。
for (var j = 0; j < app.activeDocument.stories.length; j++) {
for (var k = app.activeDocument.stories.item(j).paragraphs.length; k--; ) {
var myText = app.activeDocument.stories.item(j).paragraphs.item(k);
myText.contents = C2Unic(myText.contents, myText.appliedFont.fontFamily);
myText.appliedFont = app.fonts.item("Mangal");
myText.pointSize = myText.pointSize*0.878;
myText.composer="Adobe World-Ready Paragraph Composer";
}
}