每个流程图都会更改“TABLE_NAME”标签。
最后,每个流程图都导出为图像(.PNG)
Private Sub CreateFlowChartVisio(ByVal TemplateFilename As String, ByVal saveAs As Object)
Dim vApp As Visio.Application
Dim vDoc As Visio.Document
vApp = New Visio.Application()
vDoc = vApp.Documents.OpenEx(TemplateFilename, 4)
''///Code for replace TABLE_NAME likes below code''//
vDoc.Content.Find.Execute(FindText:="*TABLE_NAME*", ReplaceWith:=screenTitle & " Master", Replace:=Word.WdReplace.wdReplaceAll)
For Each p As Visio.Page In vDoc.Pages
Dim n As String = saveAs
p.Export(n)
Next
vDoc.Close()
End Sub
我尝试使用 Word 应用程序中的替换功能
vDoc.Content.Find.Execute(FindText:="*TABLE_NAME*", ReplaceWith:=screenTitle & " Master", Replace:=Word.WdReplace.wdReplaceAll)
但这不起作用。
答案 0 :(得分:1)
我尝试使用像Word应用程序中的替换功能
vDoc.Content.Find.Execute(FindText:="*TABLE_NAME*", ReplaceWith:=screenTitle & " Master", Replace:=Word.WdReplace.wdReplaceAll)
毫无疑问,因为每个形状都有自己的文本属性。你必须迭代页面上的所有形状。并迭代文档中的所有页面但这不起作用。
Dim p as Page
Dim shp as Shape
For each p in vDoc.Pages
For Each shp In p.Shapes
shp.Characters.Text = Replace(shp.Characters.Text, "TABLE_NAME", screenTitle & " Master")
Next shp
p.export(n)
Next p