TextArea.save deprecation

I realize that TextArea.Save has been deprecated in favor of TextArea.StyledText.RTFData. However, what if the TextArea is not styled text but standard (unstyled) text. What is the most direct method of saving the text to a disc file without transferring the text to a string and saving the string to a file?

Alternatively, can I use TextArea.StyledText.RTFData to save both standard and styled text?

TextOutputStream and TextArea.Text?

Robert, if you have code that extensively uses the depreciated TextArea.Save method, then here is an easy way to avoid changing your code:

  1. Add a module.
  2. Add a new method named “Save” to this module.
  3. Give the Save method the following parameters:

Extends ta As TextArea, f As FolderItem

  1. Add the following code to Save:

Dim t As TextOutputStream
t = TextOutputStream.Create(f)
t.Write(ta.Text)
t.Close

And walla… TextArea.Save has been un-depreciated… (well, the compiler thinks so anyway). You can now call TextArea.Save(FolderItem) from anywhere in your project.

For example:

Dim f As FolderItem
Dim dlg As new SaveAsDialog
f = dlg.ShowModal()
if f <> nil then
TextArea1.Save(f)
end if

will work just fine.