drag drop into document object

grettings,

Just started to play around with vsto 2005, from what i can see, it isn't possible, but it can't hurt to ask.. I want to drag information from the action task pane into my word document.. Is there any events exposed in the word doc that would allow me to do this

thanks

mj



Answer this question

drag drop into document object

  • richard.brown

    Actually you can drag and drop information from the Actions Pane into the Microsoft Word document.

    In a sample project I created an Actions Pane which contains a text box control. I set the AllowDrop property of the text box control to True and then added to several of the text box events to allow me to drag and drop text from the text box control to the document and from the document to the text box control.

    I have included the code from my Actions Pane class below.

    ==================================
    Public Class MyActionPane

    Private MouseIsDown As Boolean

    Private Sub TextBox1_DragDrop(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles TextBox1.DragDrop

       Me.TextBox1.Text = e.Data.GetData(DataFormats.Text)

    End Sub

    Private Sub TextBox1_DragEnter(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles TextBox1.DragEnter

       If e.Data.GetDataPresent(DataFormats.Text) Then
          
    e.Effect = DragDropEffects.Copy
       End If

    End Sub

    Private Sub TextBox1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles TextBox1.MouseDown

       MouseIsDown = True

    End Sub

    Private Sub TextBox1_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles TextBox1.MouseMove

       If MouseIsDown Then
          Me.TextBox1.DoDragDrop(Me.TextBox1.Text, DragDropEffects.Copy)
       
    End If

       MouseIsDown = False

    End Sub

    End Class

    ===========================

    Regards,

    Ken Laws
    MSFT

    This posting is provided "AS IS" with no warranties, and confers no rights.

    For more information regarding Visual Studio Tools for Office 2005:

    Best of Blogs: Visual Studio 2005 Tools for Office
    http://msdn.microsoft.com/library/default.asp url=/library/en-us/odc_2003_ta/html/odc_landvsto2005_ta.asp

    Visual Studio Tools for Office Forum
    http://forums.microsoft.com/msdn/ShowForum.aspx ForumID=16

    Visual Studio Tools for the Microsoft Office System
    http://msdn.microsoft.com/office/understanding/vsto/default.aspx


  • drag drop into document object