4D View v16

PV SAVE DOCUMENT

Home

 
4D View v16
PV SAVE DOCUMENT

PV SAVE DOCUMENT 


 

PV SAVE DOCUMENT ( area ; document ; template ; replace ; format ) 
Parameter Type   Description
area  Longint in 4D View area
document  String in Document name
template  Integer in 0 = Document; 1 = Template
replace  Integer in 0 = No replacement; 1 = Replacement
format  Longint in Document format

The PV SAVE DOCUMENT command saves the 4D View area as a disk document.

Pass in document the name and the full access path of the document to save. If you pass an empty string in this parameter, a standard save file dialog box will appear and the user can select the name and the path of the document. If the user clicks the Cancel button, the document is not saved.

The template parameter allows you to set whether the document should be saved as a standard document (template=0) or as a template (template=1). For more information on templates, refer to the PV OPEN DOCUMENT command description.

If a document of the same name exists in the indicated area, PV SAVE DOCUMENT may overwrite the existing file depending on the value of the erase parameter. In this event, if erase is set to 0, error #26 is returned: "This document already exists." If the name was set by the user (empty string in document), the operating system will display the usual "This document already exists" confirmation regardless of the erase value.

If the target document is used by another 4D View area, PV SAVE DOCUMENT returns an error if it is a template or not.

Use the PV Document format constants theme to define the format parameter, which allows you to set the format in which to save the document:

Constant Type Value
pv html Longint 3
pv sylk Longint 2
pv tab tab return Longint 1
pv view Longint 0

Example  

After opening an external document with the PV OPEN DOCUMENT command, we will first install a callback method detecting any change to the active cell.

 C_BOOLEAN(FlagModifiedArea)
 PV ON EVENT(Area;pv on active cell changed;"EventMethod")

The code for the EventMethod project method is as follows :

 C_LONGINT($1`4D View area reference
 C_LONGINT($2`Type of event
 C_LONGINT($3`Modification key code
 C_LONGINT($4`Column number
 C_LONGINT($5`Row number
 C_LONGINT($6`Ascii code of the key
 C_BOOLEAN($0`Value to return
 
 $0:=False
 FlagModifiedArea:=True `Modified area

If the document was modified, the user is then able to save the modified document and name it as desired:

 If(FlagModifiedArea) `Document modified?
    CONFIRM("Do you want to save this document as a template??";"Template";"Document")
  `This will be a template if the dialog box is confirmed (OK=1)
    PV SAVE DOCUMENT(Area;"";OK;1;pv view)
 End if

The system variable OK is set to 1 if the document has been saved correctly.



See also 

PV OPEN DOCUMENT

 
PROPERTIES 

Product: 4D View
Theme: PV Document
Number: 15978

The OK variable is changed by the command

 
HISTORY 

Created: 4D View 6.8

 
ARTICLE USAGE

4D View Language ( 4D View v16)