This is the legacy 4D documentation web site. Documentations are progressively being moved to developer.4d.com |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
4D v19
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 | Object, 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 | Value | Comment |
wk 4wp | 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 | 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 mime html | 1 | 4D Write Pro document is saved as standard MIME HTML with HTML documents and images embedded as MIME parts (encoded in base64). Expressions are computed and 4D specific tags and method links are removed. This format is particularly suitable for sending HTML emails with the SMTP_QuickSend command. |
wk pdf | 5 | .pdf extension. 4D Write Pro document is saved in PDF format, based on Page view mode.
The following metadata is exported in a PDF document:
Notes:
|
wk svg | 8 | 4D Write Pro document page is saved in SVG format, based on Page view mode. Note: When exporting to SVG, you can only export one page at a time. Use the wk page index to specify which page to export. |
wk web page complete | 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:
Pass an object in option containing the values to define the properties of the exported document. The following properties are available:
Constant | Value | Comment |
wk HTML pretty print | htmlPrettyPrint | HTML code is formatted to be easier to read. |
wk max picture DPI | maxPictureDPI | Used for resampling (reducing) images to preferred resolution. For SVG images in Windows, used for rasterization. Default values:
Maximum possible value: 1440 |
wk optimized for | optimizedFor | Defines how an exported document is optimized based on its intended medium. Possible values:
|
wk recompute formulas | recomputeFormulas | Defines if formulas must be recomputed when exported. Possible values:
|
wk visible background | visibleBackground | Displays both background images and background color (visible effect in Page or Embedded view mode only). Possible values: True/False |
wk visible footers | visibleFooters | Displays or exports the footers (for display, visible effect in Page view mode only). Possible values: True/False |
wk visible headers | visibleHeaders | Displays or exports the headers (for display, visible effect in Page view mode only). Possible values: True/False |
wk visible references | visibleReferences | Displays or exports all 4D expressions inserted in the document as references. Possible values: True/False |
The following table indicates the option available per export format:
wk 4wp | wk docx | wk mime html | wk pdf | wk web page html 4D | |
wk CID host domain name | - | - | ![]() | - | - |
wk HTML pretty print | ![]() | - | ![]() | ![]() | ![]() |
wk max picture DPI | - | always 300 | ![]() | ![]() | - |
wk optimized for | - | always wk print | ![]() | always wk print | - |
wk recompute formulas | - | ![]() | ![]() | ![]() | - |
wk visible background | - | always true | always true | ![]() | - |
wk visible footers | - | always true | always false | ![]() | - |
wk visible headers | - | always true | always false | ![]() | - |
wk visible references | - | - | - | ![]() | - |
Compatibility Note: Passing a longint value in option is supported for compatibility reasons, but it is recommended to use an object parameter.
You want to export the contents of the myArea 4D Write Pro object in both HTML and PDF format:
// export HTML
var $option : Object
$option:=New object
$option[wk recompute formulas]:=False
$option[wk HTML pretty print]:=False
$option[wk optimized for]:=wk print
$option[wk max picture DPI]:=600 //override default value for print (300 DPI)
WP EXPORT DOCUMENT(myArea;$path;wk web page complete;$option)
//export PDF
var $option : Object
$option:=New object
$option[wk visible headers]:=True
$option[wk visible footers]:=True
$option[wk visible background]:=True
$option[wk max picture DPI]:=96 //override default value for screen (192 DPI) to limit doc size
$option[wk optimized for]:=wk screen
$option[wk recompute formulas]:=True
WP EXPORT DOCUMENT(myArea;$path;wk pdf;$option)
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)
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 v19)