4D v15

WP EXPORT DOCUMENT

Home

 
4D v15
WP EXPORT DOCUMENT

WP EXPORT DOCUMENT 


 

WP EXPORT DOCUMENT ( wpDoc ; filePath {; format {; option}} )  
Parameter Type   Description
wpDoc  Object in 4D Write Pro variable
filePath  String in Path of exported file
format  Longint in Document output format
option  Longint in 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 format is supported:

Constant Type Value Comment
wk web page complete Longint 2 .htm or .html extension. The document is saved as standard HTML and its resources are saved separately. 4D tags 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:

  • "4D specific tags" means 4D XHTML with a 4D namespace and 4D CSS styles.
  • Expressions can be frozen at any time before export using ST FREEZE EXPRESSIONS.

In the options parameter, you pass options that will configure the export. You can pass a longint value to define the style of the 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
  • HTML debug option off (default):
  • HTML debug option on:

Example  

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 html debug)
 End if



See also 

WP EXPORT VARIABLE

 
PROPERTIES 

Product: 4D
Theme: 4D Write Pro Language

 
HISTORY 

Created: 4D v14 R5

 
ARTICLE USAGE

4D Write Pro Reference ( 4D v15)