问题描述
类似于我先前的问题,即根据其geometryBounds或按名称的一部分在页面上查找textFrame时,我现在遇到了查找textFrames(如果它们在组内)的问题。如果我使用所有textFrame的数组,例如:
Similar to my earlier problems with finding a textFrame on a page based on its geometricBounds or by part of its name, I now am running into the problem of finding textFrames if they are inside groups. If I use an array of all textFrames, such as:
var textFramesArray = document.textFrames.everyItem().getElements();
它将不找到组内的任何textFrame。如果textFrame在组中,我该如何解决如何引用它?即使必须将组取消分组,也可以,但是我什至无法弄清楚如何在页面上找到组!
it will not find any textFrames that are inside of a group. How can I figure out how to reference a textFrame if it's inside a group? Even if the group has to be un-grouped, that's fine, but I cannot even figure out how to find groups on the page!
推荐答案
页面上的
网上论坛是 page.groups
...,但是无论如何您都不需要这样做。 Fabian的回答很好,但是它并没有考虑到成组的问题,也没有考虑剪贴蒙版,也没有考虑表和脚注中的文字框架(等)。
Groups on a page are page.groups
... but you don't need this anyway. Fabian's answer is good, but it doesn't take groups-in-groups into account -- nor clipping masks, nor text frames inside tables and footnotes (etc.).
这里是另一种方法: allPageItems
几乎可以保证返回 all 各种形式和说服力的页面项目,这些消息在组或其他框架内或没什么。您可以依次检查,处理每个文本,或构建文本框阵列以供休闲使用:
Here is an alternative approach: allPageItems
is pretty much guaranteed to return all page items, of all kinds and persuasion, inside groups or other frames or whatnot. You can inspect, then process, each of them in turn, or build an array of text frames to work with at leisure:
allframes = app.activeDocument.allPageItems;
textframes = [];
for (i=0; i<allframes.length; i++)
{
if (allframes[i] instanceof TextFrame)
textframes.push(allframes[i]);
}
alert (textframes.length);
这篇关于在InDesign CS6中选择组内的textFrame的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!