2010-12-01 7 views
1

組織図を描画するためにVisio 2007を使用しています。
すべてが正常に動作しているが、私はすべてのヘルプは非常に理解されるであろうC#+ Visio 2007の統合

Microsoft.Office.Interop.Visio.Shape 

下の名前空間で形状オブジェクトのプロパティにアクセスして設定する方法についての問題を抱えています。

答えて

0

正確に何をしようとしていますか?ここでは、シェイプのtextプロパティを設定する方法を示します。

using Visio = Microsoft.Office.Interop.Visio; 

[...] (some code) 

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

お返事ありがとうございます。しかし、正確に必要なのは、テキストプロパティ以外のシェイプのカスタムプロパティを設定することです。 –

1

Visioは、Excelと同様のセルと呼ばれるものを広範に使用しています。形状からセル参照を取得するには :

Visio.Cell aCell = shape1.Cells("Prop.XXXX"); 

XXXXは、プロパティの名前です。セルの値を取得するには :

aCell.FormulaU 
2

それはあまりにもあなたが、他の人だけでなく、助けるかもしれない... :)

輸入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 

終了クラス

関連する問題