Hi all,

the question was:

How can I create a Word document from within REALbasic if I do not have MS Office? Is there a routine or dll out there I could use? (if so, how?)

My answer is:
-------------

What kind of data do you want to put in a Word document ?
ASCII text only, styled text, styled text with image(s), text in table(s), ???

Depending on these answers (and maybe others), you can get more informations.

You seems to run on the Windows Platform, so you have to know - it was already said in this list (see RBNUBE mail below) - that you can save EditFields as RTF documents. Using something like:

FolderItem.SaveStyledEditField EditField1

where FolderItem is a valid FolderItem reference; and EditField1 is an EditField (styled or not).

A better example can be:

  Dim SaveAsDlg As New SaveAsDialog
  Dim rtfFI     As FolderItem

  // Set some properties
  SaveAsDlg.InitialDirectory  = Volume(0).Child("Documents")
  SaveAsDlg.SuggestedFileName = "My EFdata as RTF.rtf"
  SaveAsDlg.Title  = "Saving the text data as RTF"
SaveAsDlg.Filter = FileTypes1.ApplicationRtf // Defined as a file type in FileTypes1 File Type Set

  // Show the Dialog
  rtfFI = SaveAsDlg.ShowModal()
  If rtfFI <> Nil Then
    // Save the EditField contents as rtf
    rtfFI.SaveStyledEditField EFdata

  Else
    // User canceled
  End if

It is based on the SaveAsDialog Class example.


Create a file type you name FileTypes1, add a File Type you name "ApplicationRtf" and set ".rtf" as extension.


Under Windows, you will get an rtf file that will open in WordPad if Word is not installed. The rtf data will be:

"{\rtf1\ansi\ansicpg1252\deff0\deflang1036{\fonttbl{\f0\fnil\fcharset0 MS Sans Serif;}{\f1\fnil MS Sans Serif;}}

{\colortbl ;\red0\green0\blue0;}

\viewkind4\uc1\pard\cf1\f0\fs18 These are data from the EditField.\f1\par

}



_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to