KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: Preview a 4D Write file to a Web Area
PRODUCT: 4D | VERSION: 15 | PLATFORM: Mac & Win
Published On: August 7, 2015

Here is a utility method PREVIEW_4D_WRITE_TO_WEBAREA to preview a 4D Write file to a Web Area:

// ----------------------------------------------------------------------
// Name: PREVIEW_4D_WRITE_TO_WEBAREA
// Description: Method reads in the location of the 4D Write file and
// previews the contains of the file in a Web Area.
//
// Parameters:
// $1 (Text) - File location of the 4D Write File.
// $2 (Pointer) - Pointer to the Web Area Object.
// ----------------------------------------------------------------------
C_TEXT($1;$file_loc)
C_POINTER($2;$webArea_obj)
C_TEXT($4dWrite_html_loc)
C_OBJECT($4dWritePro_loc)

If (count parameters=2)
   $file_loc:=$1
   $webArea_obj:=$2
   $4dWrite_html_loc:=Get 4D folder(Database folder)+"WriteProImport.html"

   $4dWritePro:=WP Import document($file_loc)
   WP EXPORT DOCUMENT($4dWritePro;$4dWrite_html_loc;wk web page complete;wk normal)
   WA OPEN URL($webArea_obj->;$4dWrite_html_loc)
End if



Here is an example of a 4D Write text that is saved as "test.4W7":



Here is a sample code running the method PREVIEW_4D_WRITE_TO_WEBAREA:

C_TEXT($4dWritePro_loc)

$4dWritePro_loc:=Get 4D folder(Database folder)+"test.4W7"

PREVIEW_4D_WRITE_TO_WEBAREA($4dWritePro_loc;->Web Area)


Here is the result of the contents from 4D Write file to the Web Area:



See Also: