PV EXPORT
version 6.8.1
PV EXPORT (area; document; replace; format)
Parameter | Type | Description | |
area | Longint | 4D View area | |
document | String | Document name or empty string | |
replace | Integer | 0 = No replacement; 1 = Replacement | |
format | Longint | Document format |
Description
The PV EXPORT command exports the 4D View area, or the export area, as a disk document.
In document, pass the name and complete access path of the document to be exported. If you pass an empty string in this parameter, an export file dialog box appears and the user can specify the name and location of the document. In this case, if the user clicks on the Cancel button, the document is not exported.
If a document with the same name exists in the indicated location, PV EXPORT will or will not overwrite the file according to the value of the replace parameter. In this case, when replace is 0, error no. 26 occurs: "Document already exists". If the name was defined by the user (empty string in document), it is the operating system that displays the traditional confirmation "This document already exists...", whatever the value of the replace parameter.
Use the PV Document format theme constants to define the format parameter, enabling you to specify the document recording format.
Note : The document format pv view constant cannot be applied to this command.
Unlike the PV SAVE DOCUMENT command (that saves the totality of an area), the PV EXPORT command allows the recording of just the export area of the document. The export area can be specified manually by the user (File/Export Area>Set command), or by programming using the statement PV EXECUTE COMMAND(area;pv cmd export area set). The export area consists of the cells selected at the moment of the definition of the area. By default, the export area consists of the entire document.
Example
The following example allows exporting, in HTML format, of all the selected cells in an area. If no cell is selected at the moment of export, an arbitrary range is set:
ARRAY LONGINT($ALleft;0) `Left cell column numbers
ARRAY LONGINT($ALtop;0) `Top cell row numbers
ARRAY LONGINT($ALright;0) `Right cell column numbers
ARRAY LONGINT($ALbottom;0) `Bottom cell row numbers
PV GET SELECTED RANGES LIST (area;$ALleft;$ALtop;$ALright;$ALbottom)
If (Size of array($ALleft)=0) `No cell is selected
PV SELECT RANGE(area;2;4;5;7;pv selection set) `Arbitrary range
Else
PV SELECT RANGES LIST(area;$ALleft;$ALtop;$ALright;$ALbottom;pv selection set)
End if
`To reduce export area to the selected range
PV EXECUTE COMMAND(area;pv cmd export area set)
PV EXPORT(area;"";1;pv html)
`To initialize export area for the whole document
PV EXECUTE COMMAND(area;pv cmd export area clear)
See Also
Constants
PV Document format theme.