Log In    |    Knowledge Base    |    4D Home
Tech Tip: Little known fact for procedurally saving an RTF file type in 4D Write - Mac
Published On: April 14, 2000

The command WR SAVE DOCUMENT (area; document; type) saves the document located in the 4D Write area referenced by area, using the access path passed in document where document is the name or the complete access path of the document file and type is the type of format the document is to be saved in. Occasionally the developer will find the type parameter seems to be misbehaving when saving in the RTF format. It will save as a 4D Write document rather than the requested RTF format.


WR SAVE DOCUMENT (area; document; "RTF") is supposed to save a document located in the 4D Write area as an RTF file type (see table below) and get info tells you it is a 4D Write document.

The file formats available are:

Type Windows - extension Files
4WR7 .4W7 - 4D Write 6.5
4WT7 .4WT - Template 4D Write 6.5
RTF .RTF - rtf file
ASCW .TXT - Windows text file
ASCM .TXT - Mac OS text file
ASCU .TXT - Unicode text file
HTML .HTML - HTML text file

Note: These types are virtual types; they neither correspond to Mac OS file types, nor to Windows extensions.

The reason this happens is the Mac requires a 4-character field for a file type. All the file types have 4 characters except RTF, which has only 3 characters. The developer must add a space to the end of the RTF parameter i.e.: "RTF " to get the document to save as an RTF file type. Without the space on the end, the file is saved as the default 4D Write file type.