C#和#x2B;Visio2007集成

C#和#x2B;Visio2007集成,c#,visio,C#,Visio,我正在使用Visio 2007绘制组织结构图。 一切正常,但我在如何访问和设置下面名称空间中shape对象的属性方面遇到了问题 Microsoft.Office.Interop.Visio.Shape 非常感谢您的帮助。您到底想做什么?下面是如何设置形状的文本属性 using Visio = Microsoft.Office.Interop.Visio; [...] (some code) Visio.Shape shape1 = page.Drop(currentStencil.Mast

我正在使用Visio 2007绘制组织结构图。
一切正常,但我在如何访问和设置下面名称空间中shape对象的属性方面遇到了问题

Microsoft.Office.Interop.Visio.Shape

非常感谢您的帮助。

您到底想做什么?下面是如何设置形状的文本属性

using Visio = Microsoft.Office.Interop.Visio;

[...] (some code)

Visio.Shape shape1 = page.Drop(currentStencil.Masters["Start/End"], 1.50, 1.50);
shape1.Text = "John";

Visio广泛使用了与excel单元格类似的单元格。 要从形状获取单元引用,请执行以下操作:

Visio.Cell aCell = shape1.Cells("Prop.XXXX");
XXXX是属性的名称。 要获取单元格的值,请执行以下操作:

aCell.FormulaU 

它不仅可以帮助你,也可以帮助其他人:)

导入Microsoft.Office.Interop.Visio 公共类VisioMain

Dim currentStencil As Document
Dim currentPage As Page

Private Sub VisioMain_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
    currentPage = DC.Document.Pages(1)
    SetLandscape(currentPage)

    currentStencil = DC.Document.Application.Documents.OpenEx("Rack-mounted Equipment (US units).VSS", VisOpenSaveArgs.visOpenDocked)

    Dim stencilWindow As Window
    stencilWindow = currentPage.Document.OpenStencilWindow
    stencilWindow.Activate()
End Sub

Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click

    ''Code to get individual property of Shape...........!
    For Each objShape As Microsoft.Office.Interop.Visio.Shape In currentPage.Shapes
        TextBox1.Text = objShape.Cells("Prop.Height").ResultStr("text")
    Next

    ''.............!

End Sub

下课

谢谢您的回复。但我真正需要的是设置形状的自定义属性,而不是文本属性。