This project has moved and is read-only. For the latest updates, please go here.

How to save a .docx document in the Windows clipboard

Nov 2, 2014 at 4:32 PM

I wrote this little code to construct a document that appears well when Word opens.
    Private Sub Doc3()
        Dim fileName As String = "doc3.docx"

        '-- Texte et exposant
        Dim headlineText As String = "(X, Y) µm"
        Dim expoText As String = "3"

        ' Create the document in memory:
        Dim doc = DocX.Create(fileName)
        Dim para As Paragraph = doc.InsertParagraph()

        para.Font(New FontFamily("Times New Roman")).FontSize(32)

        para.Font(New FontFamily("Times New Roman")).FontSize(32)


        Dim Dt As New DataObject
        Dt.SetData(DataFormats.Rtf, True, doc)

        Process.Start("WINWORD.EXE", fileName)

    End Sub
But how to put this document to the clipboard ( Dt.SetData(???) ) to copy in an existing Word document?

Many thanks
Dec 5, 2014 at 8:28 AM

How to put a DocX document to the clipboard ?

No one can answer this question?

Dec 8, 2015 at 2:18 PM
Maybe use AutoIt to copy to clipboard. I know that is the poor man of doing IPC but it works.
Dec 12, 2015 at 3:27 PM
Why would you need to put it into the clipboard?

Simply use Docx.Load and load the old document (kind of a template), and use the code you created to put the data into it. no need for clipboard or copy/pasting.