/// <summary>
/// 遍历图层中的所有TextFrame
/// </summary>
/// <param name="layer"></param>
/// <returns></returns>
private static List<Illustrator.TextFrame> GetLayerInText(Illustrator.Layer layer)
{
List<Illustrator.TextFrame> listText = new List<Illustrator.TextFrame>();
foreach (Illustrator.TextFrame text in layer.TextFrames)
{
listText.Add(text);
}
foreach (Illustrator.GroupItem group1 in layer.GroupItems)
{
List<Illustrator.TextFrame> listText1 = GetGroupInText(group1);
listText.AddRange(listText1);
}
return listText;
}
/// <summary>
/// 遍历组中的TextFrame
/// </summary>
/// <param name="group"></param>
/// <returns></returns>
private static List<Illustrator.TextFrame> GetGroupInText(Illustrator.GroupItem group)
{
List<Illustrator.TextFrame> listText = new List<Illustrator.TextFrame>();
foreach (Illustrator.TextFrame text in group.TextFrames)
{
listText.Add(text);
}
foreach (Illustrator.GroupItem group1 in group.GroupItems)
{
List<Illustrator.TextFrame> listText1 = GetGroupInText(group1);
listText.AddRange(listText1);
}
return listText;
}
/// <summary>
/// 遍历组中的GroupItem
/// </summary>
/// <param name="group"></param>
/// <returns></returns>
private static List<Illustrator.GroupItem> GetGroupInGroupItem(Illustrator.GroupItem group)
{
List<Illustrator.GroupItem> listGroup = new List<Illustrator.GroupItem>();
foreach (Illustrator.GroupItem groupsub in group.GroupItems)
{
listGroup.Add(groupsub);
}
foreach (Illustrator.GroupItem groupsub in group.GroupItems)
{
List<Illustrator.GroupItem> groupsub1 = GetGroupInGroupItem(groupsub);
listGroup.AddRange(groupsub1);
}
return listGroup;
}
发表评论 取消回复