使用从 vb.net 传递的数据处理 visio 形状

Manipulate visio shapes with data passed from vb.net

我有下面的代码,它打开 visio,在 visio 中打开一个文件,打印文件,然后关闭;这一切都很好。

但是,现在我的任务是将信息传递到名为 'Ticket Task' 的 visio 文档页面,将该信息绑定到某些形状,然后打印出来。

我知道 vb6 可以做到这一点(过时的代码就是这样写的),但是 vb.net 中有没有办法做到这一点?

谢谢!

代码:

''Set up the file path
                Dim docPath As String = System.Environment.GetFolderPath(System.Environment.SpecialFolder.MyDocuments) + "\" + splFileData(0) + "\" + splFileData(1) + ".vsd"
                'Set up the attributes for the opening/printing of the document.
                psi.UseShellExecute = True
                psi.Verb = "print"
                'psi.EnvironmentVariables.Add("Orders", "Hello")

                psi.Arguments = printer
                psi.WindowStyle = ProcessWindowStyle.Hidden

                psi.FileName = docPath
                Console.WriteLine("Printing: " + docPath)
                'Start the process (open visio document, print, close)
                Process.Start(psi)

您必须更改打开和打印 Visio 文档的方式。 This tutorial shows how to use VB.NET to work with documents. The Open function returns an object of type Microsoft.Office.Interop.Visio.Document. You can use this object to attach information to shapes as discussed in here。事实上,VB.NET代码与VB6非常相似。如果想让Visio不可见,可以按如下方式打开文档:

Microsoft.Office.Interop.Visio.InvisibleApp application = new Microsoft.Office.Interop.Visio.InvisibleApp();
application.Visible = false;
Microsoft.Office.Interop.Visio.Document doc = application.Documents.Open...