WR SAVE DOCUMENT

4D - Documentation   Français   English   German   4D Write, Command Theme List   4D Write, Command Alphabetical List   4D Write, Constant Theme List   Back   Previous   Next

version 6.7 (Modified)


WR SAVE DOCUMENT (area; document{; type})

ParameterTypeDescription
areaLongint4D Write area
documentStringPathname of the document to be saved
Pathname of the saved document
typeStringType of document to be saved (4 characters)
Type of saved document (4 characters)

Description

The WR SAVE DOCUMENT command saves the document located in the 4D Write area referenced by area, using the pathname passed in document.

document is the name or the complete pathname of the document file. On Windows, you must include the file extension, in order to determine the file type.

Examples:

On Windows or for crossplatform compliance, you must include the "\" character between directories: "D:\directory1\directory2\file.4W7".

On Mac OS, you must include the ":" character between folders: "MacintoshHD:Folder:Document".

If document contains only the name of the file, WR SAVE DOCUMENT will save the document in the folder of the database's structure file.

If document is an empty string, WR SAVE DOCUMENT displays the standard Save file dialog box.

When the Save (Mac OS) or OK (Windows) button of the Save file dialog box is clicked, the OK system variable is set to 1, and the document variable will be assigned the complete pathname of the file the user selects.

In this case, the type parameter returns the type selected by the user in the type drop-down list, or the document type if no type was selected by the user.

If the user clicks the Cancel button, document returns an empty string and the OK system variable is set to 0.

File formats can be selected from the Type drop-down list (on Windows) or from the type pop-up menu in the Save file dialog box.

The available file formats are:

TypeFilesWindows extension
4WR74D Write.4W7
4WT7Template 4D Write.4WT
RTF (*)RTF file.RTF
ASCWWindows text file.TXT
ASCMMac OS text file.TXT
ASCUUnicode text file.TXT
HTMLHTML text file.HTM
DOC8Word 97 Win/Word 98 Mac OS.DOC

(*) Add a space after "RTF" in order to obtain the 4 characters required.

The type parameter is used for the document encoding only. It corresponds neither to a Mac OS file type, nor to a Windows extension.

However, the parameter is used by 4D Write to determine the appropriate value for the Windows file extension or the Mac OS file creator/type:

Windows

4D Write formatExtension
4D Write.4W7
RTF.RTF
HTML.HTM
ASCII PC/Mac.TXT
ASCII unicode.TXT
Word.DOC

The file extension is defined according to the type parameter value, even if the name already has an extension. For example, if you pass "Report.RTF" in the document parameter and "HTML" in type, the file will be named "Report.HTM".

Mac OS

4D Write formatCreatorType
4D Write4DW74WR7
RTF4DW7RTF
HTMLMOSSTEXT
ASCII PC/Mac4DW7TEXT
ASCII unicode4DW7TEXT
WordMSWDW8BN

Note: Exporting in Word format does not support pictures (of any type), bullets or hypertext links.

Examples

(1) You want to save the document named 'LetterClient' in the 4D Write file format. This document will be saved into the "WriteDocuments" folder located at the same level as the database's structure file:

      `Getting the full pathname to the database structure file
   $Doc:=Structure file
   Doc:=$Doc
   $long:=0
      `Getting position of the last separator to remove structure name from full pathname
   While((Position(":";$Doc)#0)
      $Doc:=Substring($Doc;1+Position(":";$Doc);Length($Doc))
      $Long:=Length($Doc)
   End while
      `Concatenating names to build the full pathname of the document
      `Adding an extension to the document allows cross-platform document management
   Doc:=Substring(Doc;1;Length(Doc)-$Long)+"WriteDocuments:LetterClient.4W7"
   WR SAVE DOCUMENT(Area;doc;"4WR7")

(2) You want to give the user the ability to choose both the name and type of the document to save. Then, you want to retrieve the chosen values:

   DocName:=""
   DocType:=""
   WR SAVE DOCUMENT (Area;DocName;DocType)
   If (OK=1)
      ...    `Using the DocName and DocType values
   End if

See also

WR OPEN DOCUMENT.


4D - Documentation   Français   English   German   4D Write, Command Theme List   4D Write, Command Alphabetical List   4D Write, Constant Theme List   Back   Previous   Next