<?xml version="1.0" encoding="utf-8"?>
<feed xml:lang="en" xmlns="http://www.w3.org/2005/Atom"><title>Recent changes to Open a word processing document from a stream</title><link href="https://sourceforge.net/p/asposeopenxml/wiki/Open%2520a%2520word%2520processing%2520document%2520from%2520a%2520stream/" rel="alternate"/><link href="https://sourceforge.net/p/asposeopenxml/wiki/Open%20a%20word%20processing%20document%20from%20a%20stream/feed.atom" rel="self"/><id>https://sourceforge.net/p/asposeopenxml/wiki/Open%2520a%2520word%2520processing%2520document%2520from%2520a%2520stream/</id><updated>2015-05-26T04:32:31.564000Z</updated><subtitle>Recent changes to Open a word processing document from a stream</subtitle><entry><title>Open a word processing document from a stream modified by Aspose Marketplace</title><link href="https://sourceforge.net/p/asposeopenxml/wiki/Open%2520a%2520word%2520processing%2520document%2520from%2520a%2520stream/" rel="alternate"/><published>2015-05-26T04:32:31.564000Z</published><updated>2015-05-26T04:32:31.564000Z</updated><author><name>Aspose Marketplace</name><uri>https://sourceforge.net/u/asposemp/</uri></author><id>https://sourceforge.netfc2a7a3a7fe31034c01cbf296c1aa6906bc8543f</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;pre&gt;--- v2
+++ v3
@@ -35,4 +35,4 @@

 ## Download ##

-* [Sample Code]()
+* [Sample Code](http://sourceforge.net/projects/asposeopenxml/files/Aspose.Words%20Vs%20OpenXML/OpenDocumentFromStream.zip/download)
&lt;/pre&gt;
&lt;/div&gt;</summary></entry><entry><title>Open a word processing document from a stream modified by Aspose Marketplace</title><link href="https://sourceforge.net/p/asposeopenxml/wiki/Open%2520a%2520word%2520processing%2520document%2520from%2520a%2520stream/" rel="alternate"/><published>2015-05-25T19:36:15.977000Z</published><updated>2015-05-25T19:36:15.977000Z</updated><author><name>Aspose Marketplace</name><uri>https://sourceforge.net/u/asposemp/</uri></author><id>https://sourceforge.net370acbca1f56628e027c63f74336d70ca011b95c</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;pre&gt;--- v1
+++ v2
@@ -1,4 +1,4 @@
-## OpenXML Word ##
+## OpenXML Words ##

 The example **OpenAndAddToWordprocessingStream** method shown here can be used to open a Word document from an already open stream and append some text using the Open XML SDK. You can call it by passing a handle to an open stream as the first parameter and the text to add as the second. For example, the following code example opens the file OpenDocumentFromStream.docx in the Public Documents folder and adds text to it.
 Below is the sample code
&lt;/pre&gt;
&lt;/div&gt;</summary></entry><entry><title>Open a word processing document from a stream modified by Aspose Marketplace</title><link href="https://sourceforge.net/p/asposeopenxml/wiki/Open%2520a%2520word%2520processing%2520document%2520from%2520a%2520stream/" rel="alternate"/><published>2015-05-25T19:30:35.055000Z</published><updated>2015-05-25T19:30:35.055000Z</updated><author><name>Aspose Marketplace</name><uri>https://sourceforge.net/u/asposemp/</uri></author><id>https://sourceforge.net2c7b6b59d35b757e671fe2d1dadb72ccc7c89987</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;h2 id="openxml-word"&gt;OpenXML Word&lt;/h2&gt;
&lt;p&gt;The example &lt;strong&gt;OpenAndAddToWordprocessingStream&lt;/strong&gt; method shown here can be used to open a Word document from an already open stream and append some text using the Open XML SDK. You can call it by passing a handle to an open stream as the first parameter and the text to add as the second. For example, the following code example opens the file OpenDocumentFromStream.docx in the Public Documents folder and adds text to it.&lt;br /&gt;
Below is the sample code&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;        string txt = "Append text in body - OpenAndAddToWordprocessingStream";
        Stream stream = File.Open(OpenDocumentFromStream.docx, FileMode.Open);
        OpenAndAddToWordprocessingStream(stream, txt);
        stream.Close();
&lt;/pre&gt;&lt;/div&gt;
&lt;h2 id="asposewords"&gt;Aspose.Words&lt;/h2&gt;
&lt;p&gt;Simply pass a stream object that contains a document to the &lt;strong&gt;Document&lt;/strong&gt; constructor. &lt;br /&gt;
Below is the sample code&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;        string txt = "Append text in body - OpenAndAddToWordprocessingStream";
        //intialize stream by defining file mode
        Stream stream = File.Open(OpenDocumentFromStream.docx, FileMode.Open);
        OpenAndAddToWordprocessingStream(stream, txt);
        private static void OpenAndAddToWordprocessingStream(Stream stream, string txt)
        {
           // Load the entire document into memory.
           Document doc = new Document(stream);
           // You can close the stream now, it is no longer needed because the document is in memory.
           stream.Close();
           //intialize documentbuilder to insert text from stream into word document
           DocumentBuilder db = new DocumentBuilder(doc);
           db.Writeln(txt);
           doc.Save(OpenDocumentFromStream.docx);
        }
&lt;/pre&gt;&lt;/div&gt;
&lt;h2 id="download"&gt;Download&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="../"&gt;Sample Code&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;/div&gt;</summary></entry></feed>