This is the legacy 4D documentation web site. Documentations are progressively being moved to developer.4d.com |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
4D v18
WP EXPORT DOCUMENT
|
WP EXPORT DOCUMENT ( wpDoc ; filePath {; format {; option}} ) | ||||||||
Parameter | Type | Description | ||||||
wpDoc | Object |
![]() |
4D Write Pro variable | |||||
filePath | String |
![]() |
Path of exported file | |||||
format | Longint |
![]() |
Document output format | |||||
option | Longint |
![]() |
Export options | |||||
The WP EXPORT DOCUMENT command exports the wpDoc 4D Write Pro object to a document on disk according to the filePath parameter as well as any optional parameters.
In wpDoc, pass the 4D Write Pro object that you want to export.
In filePath, pass the destination path and the name of the document to be exported. If you pass only the document name, it will be saved at the same level as the 4D structure file. By default, if you omit the format parameter, the command uses the document extension to select the file format.
You can also pass a constant from the 4D Write Pro Constants theme in the format parameter. In this case, 4D adds the appropriate extension to the file name if needed. The following formats are supported:
Constant | Type | Value | Comment |
wk 4wp | Longint | 4 | 4D Write Pro document is saved in a native archive format (zipped HTML and images saved in a separate folder). 4D specific tags are included and 4D expressions are not computed. This format is particularly suitable for saving and archiving 4D Write Pro documents on disk without any loss. |
wk docx | Longint | 7 | .docx extension. 4D Write Pro document is saved in Microsoft Word format. Certified support for Microsoft Word 2010 and newer. The document parts exported are:
|
wk web page complete | Longint | 2 | .htm or .html extension. Document is saved as standard HTML and its resources are saved separately. 4D tags and links to 4D methods are removed and expressions are computed. This format is particularly suitable when you want to display a 4D Write Pro document in a web browser. |
Notes:
In the option parameter, you can pass a longint value to define the style of the exported HTML code. The following constants are available:
Constant | Type | Value | Comment |
wk html debug | Longint | 1 | Formatted HTML code ("pretty print"), easier to debug |
wk normal | Longint | 0 | Standard HTML code |
You want to export the contents of the myArea 4D Write Pro object to a document in your database folder. You can set the debug option using a 'pprint' button:
C_TEXT($filePath)
$filePath:=Get 4D folder(Database folder)+"Exported files"+Folder separator+"WriteProExport.html"
If(pprint=0) //if the debug option is off
WP EXPORT DOCUMENT(myArea;$filePath;wk web page complete;wk normal)
Else
WP EXPORT DOCUMENT(myArea;$filePath;wk web page complete;wk debug format)
End if
You want to export the contents of the myArea 4D Write Pro object in .4wp format:
C_TEXT($path)
C_LONGINT($docRef)
Case of
:(Form event code=On Clicked)
$path:=Get 4D folder(Database folder)+"Export"+Folder separator
$path:=Select document($path;".4wp";" title";File name entry)
If($path#"")
WP EXPORT DOCUMENT(myArea;document;wk 4wp;wk normal)
Else
ALERT("An error occurred.")
End if
End case
Product: 4D
Theme: 4D Write Pro Language
Number:
1337
Created: 4D v14 R5
Modified: 4D v15 R2
Modified: 4D v17 R4
4D Write Pro Reference ( 4D v18)