
You can now read a document even if it is already open in write mode: vDoc:= Open document ("PassFile" "TEXT") ` The file is open ` Before the file is closed, it is possible to consult it in read-only mode: vRef:= Open document ("PassFile" "TEXT" Read Mode) If the document already contains the string "Hello", this string would be overwritten: C_TIME(vhDoc) vhDoc:= Open document ("Note" Read and Write) ` Open a document called Note If (OK=1) SEND PACKET (vhDoc"Good-bye") ` Write one word into the document CLOSE DOCUMENT (vhDoc) ` Close the document End ifĢ. The following example opens an existing document called Note, writes the string "Good-bye" into it, and closes the document. 4th Dimension offers the following predefined constants, located in the "System Documents" theme:ĭo not forget to eventually call CLOSE DOCUMENT for the document.ġ. Four different open file modes are possible. The optional mode parameter allows you to define how document is to be opened. Once you have opened a document, you can read and write in the document using the RECEIVE PACKET and SEND PACKET commands that you can combine with the Get document position and SET DOCUMENT POSITION commands in order to directly access any part of the document. If a document is open, Open document initially sets the file position at the beginning of the document while Append document sets it at the end of the document. If it still does not find it, it will return a "File not found" error.

If it does not find it, it tries to open the document with the. If a document type is not specified, Open document tries to open the document with no file extension. If you pass more than three characters in fileType, Open document only takes the first three characters into account. Will try to open the document "C:\\Letter.WRI" on your disk. For example: vhDocRef:= Open document("C:\\Letter" "WRI") If you specify the fileType parameter, Open document tries to open the document whose name is "Document.fileType". By default, Open document attempts to open a. On Windows, even if you do not use the Open File dialog box, you might pass the fileType parameter to specify the file extension of the document you want to open.
#All word documents open with no margin windows#
To show another type of document, in fileType, pass a 1 to 3-character Windows file extension or a Macintosh file type mapped using the MAP FILE TYPES command. On Windows, if you use the Open File dialog box, all types of documents *.* are presented by default. To show another type of document, specify a document type in the optional fileType parameter.

On Macintosh, if you use the Open File dialog box, all documents are presented by default. If the document does not exist, an error is generated.

If the document is already open and you try to open it in Write mode, an error is generated. If the document is already open and the mode parameter is omitted, Open document opens the document in Read mode and sets the OK variable to 1. If the document is correctly opened, Open document returns its document reference number and sets the OK variable to 1. If you cancel the dialog, no document is opened Open document returns a null DocRef and sets the OK variable to 0. If you pass an empty string in document, the Open File dialog box is presented, and you then select the document to be open. The Open document command opens the document whose name or pathname you pass in document. Windows file extension (1 to 3-character string) or Open document (document) DocRefĮmpty string for standard file dialog box
