SaveToFile Method

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

Declaration

bool SaveToFile([In] string filename, [In] bool OnlySelection, [In] string FormatStr);

Description

Save text to a file. The engine will determine the format using the extension - unless you specify it using a format string such as "RTF", "HTML", "ANSI", "UNICODE" or "MIME".

Parameters

filename

The name of the file

SelectionOnly

true to only save the selected text.

FormatStr

Select the writer and set options. See FormatStrings.

 

This VB.NET example code display a file save dialog and saves the text in the editor:

 

   Dim SaveFileDialog As New SaveFileDialog

   SaveFileDialog.InitialDirectory = My.Computer.FileSystem.SpecialDirectories.MyDocuments

   SaveFileDialog.Filter = "Textfiles (*.rtf,*.wpt,*.htm,*.html)|*.rtf;*.wpt;*.htm;*.html|All Files (*.*)|*.*"

 

   If (SaveFileDialog.ShowDialog(Me) = System.Windows.Forms.DialogResult.OK) Then

           Dim FileName As String = SaveFileDialog.FileName

           If Not WpdllInt1 Is Nothing Then

               Dim memo As WPDynamic.IWPMemo

               memo = WpdllInt1.Memo

               If Not memo.SaveToFile(FileName, False, "AUTO") Then

                   MessageBox.Show("Cannot write " + FileName)

               End If

           End If

   End If

Category

Load and Save


[idh_iwpmemo_savetofile.htm]    Copyright © 2007 by WPCubed GmbH