次の方法で共有


Document インターフェイス

更新 : 2007 年 11 月

環境で、編集用に開いているドキュメントを表します。

名前空間 :  EnvDTE
アセンブリ :  EnvDTE (EnvDTE.dll 内)

構文

'宣言
<GuidAttribute("63EB5C39-CA8F-498E-9A66-6DD4A27AC95B")> _
Public Interface Document
'使用
Dim instance As Document
[GuidAttribute("63EB5C39-CA8F-498E-9A66-6DD4A27AC95B")]
public interface Document
[GuidAttribute(L"63EB5C39-CA8F-498E-9A66-6DD4A27AC95B")]
public interface class Document
public interface Document

解説

Document オブジェクトは、環境で開いている各ドキュメントまたはデザイナを表します。つまり、ツール ウィンドウではなく、テキストの編集領域のあるウィンドウです。Document オブジェクトには、ドキュメントの操作に使用できるメンバ (プロパティ、メソッド、およびイベント) が含まれます。Visual Studio エディタで編集したテキスト ファイルの場合、このオブジェクトには TextDocument オブジェクトも関連づけられています。

開いているすべてのドキュメントは、Documents コレクション内で参照されます。このコレクションのドキュメントに繰り返しアクセスして、特定のドキュメントを検索できます。

Document オブジェクトの既定のプロパティは、Name プロパティです。

このオブジェクトを参照するには、DTE.Documents.Item(...) を使用します。

Sub DocumentExample()
    Dim doc As Document
    Dim desc As String

    Set doc = DTE.ActiveDocument
    desc = "You are editing a "
    If (doc.ReadOnly) Then
        desc = desc & "read-only"
    Else
        desc = desc & "writable"
    End If
    desc = desc & " document called " & doc.Name & " located at " & doc.Path
    MsgBox desc
End Sub

参照

参照

Document メンバ

EnvDTE 名前空間