Save To Stream

My application needs to save documents created by DocIO using a UNC path. Since the standard IWordDocument.Save Method (String, FormatType)does not support UNC paths, I would like to use the IWordDocument.Save Method (Stream, FormatType) method since the stream does support the UNC path.

In reading the help, it refers to a "Save To Stream" sample but I can't find it in any of my samples with 4.4.0.51 or on your web site. Would you please send me the sample or provide a code snippet demonstrating how to use the Save method with a stream method.

Thanks.

1 Reply

MW Melba Winshia Syncfusion Team February 17, 2007 10:23 AM UTC

Hi Jay,

You can use the following code snippets to save the document to a Memory Stream.

[c#]

//Create MemoryStream for storing the document.
MemoryStream memStream = new MemoryStream();
//Save document to stream.
document.Save ( memStream , FormatType.Doc );
memStream.Seek ( 0 , SeekOrigin.Begin );

//Create a FileStream
FileStream fs = new FileStream("Sample.doc",FileMode.Create);
memStream.WriteTo(fs);

//Close streams.
memStream.Close();
fs.Close();

Here is the sample for your reference:

Stream.zip

Kindly take a look at the sample above and let me know if you have any other questions.

Thanks,
Melba

Loader.
Up arrow icon