4D v16WP EXPORT VARIABLE |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
4D v16
WP EXPORT VARIABLE
|
WP EXPORT VARIABLE ( wpDoc ; destination ; format {; option} ) | ||||||||
Parameter | Type | Description | ||||||
wpDoc | Object |
![]() |
4D Write Pro variable | |||||
destination | Text variable, BLOB variable |
![]() |
Variable to receive exported contents | |||||
format | Longint |
![]() |
Variable output format | |||||
option | Longint, String |
![]() |
Export options | |||||
The WP EXPORT VARIABLE command exports the wpDoc 4D Write Pro object to the 4D destination variable in the specified format.
In wpDoc, pass the 4D Write Pro object that you want to export.
In destination, pass the variable that you want to fill with the exported 4D Write Pro object. The type of this variable depends on the export format specified in the format parameter:
In the format parameter, pass a constant from the 4D Write Pro Constants theme to set the export format you want to use. Each format is related to a specific use. The following formats are supported:
Constant | Type | Value | Comment |
wk 4wp | Longint | 4 | The 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 mime html | Longint | 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 are removed. This format is particularly suitable for sending HTML emails with the SMTP_QuickSend command. |
wk web page html 4D | Longint | 3 | 4D Write Pro document is saved as HTML and includes 4D specific tags; each expression is inserted as a non-breaking space. Since this format is lossless, it is appropriate for storing purposes in a text field. |
Notes:
In the options parameter, you pass options that will configure the export. You can pass either:
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 send an email containing styled text, 4D references and images. You can use a 4D Write Pro area exported in MIME HTML format and sent using 4D Internet Commands:
C_LONGINT($smtpid_l;$err_l;$smtpOption_l;$smtpPort_l)
C_TEXT($str;$emailBody_t;$smtpHost_t;$emailTo_t;$emailFrom_t;$smtpPass_t)
//export area in appropriate format
WP EXPORT VARIABLE(myWPArea;$str;wk mime html)
$emailTo_t:="johnsmith@4d.com"
$emailFrom_t:="testWritePro@gmail.com"
$emailBody_t:=$str
$smtpHost_t:="smtp.gmail.com"
$smtpOption_l:=9
$smtpPort_l:=465
$smtpPass_t:="QRN_on_bretzelburg"
$err_l:=SMTP_QuickSend($smtpHost_t;$emailFrom_t;$emailTo_t;$emailTitle_t;\
$emailBody_t;$smtpOption_l;$smtpPort_l;$smtpUser_t;$smtpPass_t)
If(($err_l=0))
ALERT("Email sent to "+emailTo_t)
Else
ALERT("Error in parameters, please try again.")
End if
Product: 4D
Theme: 4D Write Pro Language
Created: 4D v14 R5
Modified: 4D v15 R2
4D Write Pro Reference ( 4D v16)