SaveToVar Method

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

Saves to a variant variable

Declaration

object SaveToVar([In] bool OnlySelection, [In, MarshalAs(UnmanagedType.BStr)] string FormatStr);

Description

This method saves the contents or the selected text to a variant array of bytes. This method requires less resources than SaveToString.

 

It can be

 

C# Example - copy text from one editor to another using SaveToVar/LoadFromVar

 

object currtext = wpdllInt1.Memo.SaveToVar(false, "WPT");

wpdllInt2.Memo.LoadFromVar(currtext, false, "AUTO");

 

Parameters

 

SelectionOnly - true to only save the selected text.

 

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

Returns

A variant or "object". The created data is null or an array of bytes!

 

ASP.NET example:

Response.Clear();

// Add new header  for RTF 

Response.ContentType = "application/rtf";

Response.AddHeader("Content-Type", "application/rtf");

Response.AddHeader("Content-Disposition","inline;filename=" + afile + ".rtf");

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

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

Category

Load and Save


[idh_iwpmemo_savetovar.htm]    Copyright © 2007 by WPCubed GmbH