我有一个包含40多个页面/标签的Visio文档。每个页面都有多个图层,我试图生成文档中所有图层的列表,这样我就可以确认已经遵守了命名约定,而无需单独浏览每个页面。
有谁知道这是否可以输出这样的清单 e.g。
答案 0 :(得分:0)
当然,这是可能的。您可以使用VBA宏来完成任务,例如外部脚本。 Visio拥有丰富的API;你可以查看相关的官方文件。
答案 1 :(得分:0)
谢谢尼古拉。 我希望能找到开箱即用的东西,但VBA来救援。如果这对其他人有用,这是我的代码:
Sub List_page_Layers()
Dim Pageobj As Visio.Page
Dim PageLayer As Visio.Layer
Dim myFile As String
Dim layerVal As String
Dim searchString as String
searchString = "SOME TEXT" 'This allows me to filter as there were a couple of pages I wasn't interested and all other pages had a common string in their name
myFile = "C:\\Temp\\Layers.txt"
Open myFile For Output As #1
For Each Pageobj In ActiveDocument.Pages
If InStr(Pageobj.Name, searchString) Then
For Each PageLayer In Pageobj.Layers
layerVal = Pageobj.Name & " - " & PageLayer.Name
Write #1, layerVal
Next
End If
Next
Close #1
End Sub
这将输出一个带有图层名称的文本文件,然后我可以根据需要使用