Note that there are some explanatory texts on larger screens.

plurals
  1. POdeclaring New instance of WordprocessingDocument using OpenXML
    primarykey
    data
    text
    <p>I am attempting to use open XML for the first time. I am following a tutorial found here <a href="http://www.codeproject.com/Articles/36694/Creation-of-a-Word-2007-document-using-the-Open-XM" rel="nofollow">http://www.codeproject.com/Articles/36694/Creation-of-a-Word-2007-document-using-the-Open-XM</a>. When I declare a variable as new <code>WordprocessingDocument</code> I receive the error: </p> <blockquote> <p>"Type WordprocessingDocument.Create is undefined". </p> </blockquote> <pre><code>Imports DocumentFormat.OpenXml Imports DocumentFormat.OpenXml.Wordprocessing Imports DocumentFormat.OpenXml.Packaging Partial Class test Public Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click makedoc("file.docx") End Sub Private Sub makedoc(ByVal documentfilename As String) Using mydoc As New WordprocessingDocument.Create(documentfilename, WordprocessingDocumentType.Document) Dim mainPart As MainDocumentPart = mydoc.AddMainDocumentPart() 'Create Document tree for simple document. mainPart.Document = New Document() 'Create Body (this element contains 'other elements that we want to include Dim body As New Body() 'Create paragraph Dim paragraph As New Paragraph() Dim run_paragraph As New Run() ' we want to put that text into the output document Dim text_paragraph As New Text("Hello World!") 'Append elements appropriately. run_paragraph.Append(text_paragraph) paragraph.Append(run_paragraph) body.Append(paragraph) mainPart.Document.Append(body) ' Save changes to the main document part. mainPart.Document.Save() End Using </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload