SaveToStream Method

[Top]  [Chapter]  [Previous]  [Next]

Declaration

bool SaveToStream([In] object Stream, [In] bool OnlySelection, [In] string FormatStr);

Description

Save data to a stream.

 

.NET: The stream converter Stream2WPStream must be re-created for each load and save operation!

 

Example:

System.IO.Stream str = new System.IO.MemoryStream();

Memo.SaveToStream( new WPDynamic.Stream2WPStream(str) ,false,"RTF");

str.Position = 0;

Memo.LoadFromStream(new WPDynamic.Stream2WPStream(str), true, "AUTO");

 

Tip: You can use SaveToStream to load into an .NET array of bytes:

 

wpdllint1.Memo.SaveToStream(new WPDynamic.Stream2WPStream(stream), false"RTF");

byte[] buf = new byte[stream.Length];

stream.Seek(0,0); // don't forget!

stream.Read(buf,0,buf.Length);

 

This code has the same effect as

object buf = wpdllint1.Memo.SaveToVar(false, "RTF");

if(buf!=null) Response.BinaryWrite((byte[])buf);

 

Parameters:

Stream : This can be either a reference to a IStream interface or a a reference to the Stream2WPStream converter provided by the .NET assembly.

SelectionOnly : true to only save the selected text.

FormatStr : Select the writer and set options. See FormatStrings.

Category

Load and Save


[idh_iwpmemo_savetostream.htm]    Copyright © 2007 by WPCubed GmbH