4D v13

WR OPEN DOCUMENT

Home

 
4D Write v13
WR OPEN DOCUMENT

WR OPEN DOCUMENT 


 

WR OPEN DOCUMENT ( area ; document ; type ) 
Parameter Type   Description
area  Longint in 4D Write area
document  String in Path of document to open
in Path of the open document
type  String in Type of the document to open (4 characters)
in Type of the open document (4 characters)

The WR OPEN DOCUMENT command opens the document specified by document and places it in the 4D Write area referenced by area.

document is the name or the complete access path of the document file.
Examples:

  • On Windows, 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 the document does not have an extension (Macintosh document), 4D Write will try whatever is best to open it.

If document contains only the name of the file, WR OPEN DOCUMENT will look for the document in the folder of the database's structure file.

If document is an empty string, WR OPEN DOCUMENT displays the standard Open file dialog box.
When the Open button of the Open file dialog box is clicked, the OK system variable is set to 1, and the document variable will be assigned the complete access path of the file the user selects.
If the user clicks the Cancel button, document returns an empty string and the OK system variable is set to 0.
The optional type parameter allows you to filter the document types displayed by default in the standard Open file dialog box— except for HTML documents. For HTML documents, the type parameter is used for displaying either the HTML source code (if type "TEXT" is passed) or the HTML page (if type contains "HTM3", "HTML" or is omitted). (Note that only the HTML 3 format is supported by 4D Write).

You can set the type using one of the following constants, found in the "WR Document types" theme:

Constant Type Value Comment
wr 4D Write document String 4WR7 4D Write current version format document
wr 4D Write template String 4WT7 4D Write template format document
wr HTML 3 document String HTM3 HTML 3.2 format text
wr Macintosh text document String ASCM Mac OS format text
wr RTF document String RTF RTF format document
wr unicode document UTF16 String ASCU Unicode 16-byte format text
wr unicode document UTF8 String ASC8 Unicode 8-byte format text
wr Windows text document String ASCW Windows format text

Compatibility note: To retain compatibility with previous versions, the 4WR6 (4D Write 6.0 Document) and DOC6 (Word 6 Document) types are also supported.

In all cases, after the command is executed, the type variable returns the type of the actual open document.

Example  

The following example opens a file located in the database's directory.

 WR OPEN DOCUMENT(area;"HD:Folder:database folder:File")'On Mac OS
 WR OPEN DOCUMENT(area;"D:\\directory\\Basedirectory\\file.4W7")'On Windows

 
PROPERTIES 

Product: 4D
Theme: WR Documents
Number: 89219

The OK variable is changed by the command

 
INDEX

Alphabetical list of commands

 
HISTORY 

Modified: 4D Write 6.5

 
SEE ALSO 

WR SAVE DOCUMENT