4D v16

WP EXPORT DOCUMENT

Home

 
4D v16
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 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 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.
  • For more information about the 4D Write Pro format, refer to .4wp document format.

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:

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

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=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



See also 

WP EXPORT VARIABLE

 
PROPERTIES 

Product: 4D
Theme: 4D Write Pro Language

This command can be run in preemptive processes

 
HISTORY 

Created: 4D v14 R5
Modified: 4D v15 R2

 
ARTICLE USAGE

4D Write Pro Reference ( 4D v16)