• No results found

DataFlex Reports is a great tool for authoring and generating reports. In some situations it is useful to use it without the graphical user interface, to simply print a report for instance. This is a basic form of automation which DataFlex Reports support via command line arguments.

DataFlex Reports supports the following command line options:

Option Description

-autoclose Close DataFlex Reports once the preceding command(s) are completed.

-cmdfile Read the command line options from file. Useful for multiple commands.

-csvexport Export the specified report to a CSV file.

-htmlexport Export the specified report to an HTML file.

-imageexport Export the specified report to an image file (GIF, JPG, or TIFF).

-pdfexport Export the specified report to a PDF file.

-print Print the specified report.

-report Open the specified report

-rtfexport Export the specified report to a RTF file.

-run Open the specified report and its preview.

-x Start DataFlex Reports with the specified workspace.

-xlsexport Export the specified report to an Excel XLS file.

18.1 Close DataFlex Reports

The -autoclose option is special. It is meant to be used in combination with one of the other options. When this option is specified at the end DataFlex Reports will perform all preceding commands and then close.

18.2 Open a report

When opening a .dpl or .dr file from Windows Explorer, DataFlex Reports is started using the -report option in order to load the specified report. The example below will open DataFlex Reports with the file

C:\Reports\Report Example.dr opened.

–report "C:\Reports\Report Example.dr"

It is possible to open multiple reports and page layers by adding additional -report statements, like this example:

–report "C:\Reports\Report Example.dr" –report "C:\Reports\Company Logo.dpl"

18.3 Open a report preview

The -run options opens a report and immediately previews it as well.

18.4 Start DataFlex Reports with a specific workspace

Normally with each new report you have to select the database. This can become a nuisance when creating multiple reports for the same project. The -x option can be used to start DataFlex Reports with a specific workspace, making its database available for every report created during that session.

The following example opens DataFlex Reports with the Order Entry example workspace.

-x "C:\DataFlex 18.0 Example\Order Entry\Order Entry.sws"

This option cannot be repeated – only one workspace file can be opened per session.

18.5 Print a report

The -print option can be used to open a report, and immediately print it. The program will prompt you for the printing options and printer to use. For example, to print a report:

-print "C:\Reports\Report Example.dr"

18.6 Export a report

As described in paragraph 4.1 DataFlex Reports can export a report to several formats. This can also be facilitated from the command line, which for example is useful for weekly or monthly report exports.

Each of the available export formats has its own set of options. Partially they overlap but they will be described separately in each of the following paragraphs. The only option that is required for all exports is -exportfile. This options is used to specify the output file path.

18.6.1 HTML export

The -htmlexport exports the report to HTML and supports only a few customization options.

Option Description

Multipage This boolean option, which is true by default, specifies that the entire report will be exported. When false, only a single page is exported.

Page If the multipage option is false, this option specifies which page is exported. By default this is set to page 1.

18.6.2 RTF export

The -rtfexport option exports the report to an RTF file.

Option Description

Allpages This boolean option, which is true by default, specifies that the entire report will be exported. When false, only a single page is exported.

Page If the allpages option is false, this option specifies which page is exported. By default this is set to page 1.

18.6.3 PDF export

The PDF export is triggered using the -pdfexport option.

Option Description

Allpages This boolean option, which is true by default, specifies that the entire report will be exported. When false, only a single page is exported.

Image Default is OLEdrLow (0).

Ownerpwd Specifies a password that must be entered to open the PDF for editing. Default is no password.

Page If the allpages option is false, this option specifies which page is exported. By default this is set to page 1.

Pagemode Default is OLEdrNormal (0).

Userpwd Specifies a password that must be entered to open the PDF for reading. Default is no password.

18.6.4 CSV export

Option Description

Allpages This boolean option, which is true by default, specifies that the entire report will be exported. When false, only a single page is exported.

Delimiter Default is ‘,’.

Groupsections Default is “False”.

Option Description

Page If the allpages option is false, this option specifies which page is exported. By default this is set to page 1.

Pagesections Default is “False”.

Reportsections Default is “False”.

Separator "

18.6.5 XLS export

Option Description

Allpages Default is “True”.

Columnwidth Default is 20.

Dataonly Default is “False”.

Groupsections Default is “True”.

Nosheets Default is OLEdrNoSheets (0).

Page Default is “1”.

Pagesections Default is “True”.

Reportsections Default is “True”.

Version Default is OLEdrXLS2003 (0).

18.6.6 Image export

Option Description

Multipage Default is “False”.

Page Default is “1”.

Type Default is OLEdrJPEG (1).

'jpeg' ‘png’ 'tiff’ 'gif'

18.7 Using a command file

-pdfexport "C:\Examples\DataFlex 18.0 Examples\Order

Entry\Reports\CustomerList.vrw" EXPORTFILE=c:\tmp\ik1234.pdf PAGEMODE=1 OWNERPWD=vincent USERPWD=DataFlex ALLPAGES=0 PAGE=3 IMAGE=1 -autoclose

-x "C:\Examples\DataFlex 18.0 Examples\Contact Management\Contact Management.sws"

-x "C:\Examples\DataFlex 18.0 Examples\Contact Management\Programs\config.sws"

-csvexport "C:\Examples\DataFlex 18.0 Examples\Order

Entry\Reports\CustomerList.vrw" EXPORTFILE=c:\tmp\ik1234.csv SEPARATOR=34 DELIMITER=44 REPORTSECTIONS=1 GROUPSECTIONS=0 PAGESECTIONS=1 ALLPAGES=0 PAGE=3 -autoclose

-xlsexport "C:\Examples\DataFlex 18.0 Examples\Order

Entry\Reports\CustomerList.vrw" EXPORTFILE=c:\tmp\ik1234.xls VERSION=2007 NOSHEETS=1 REPORTSECTIONS=1 GROUPSECTIONS=0 PAGESECTIONS=1 ALLPAGES=0 PAGE=3 COLUMNWIDTH=30 DATAONLY=0 -autoclose

-rtfexport "C:\Examples\DataFlex 18.0 Examples\Order

Entry\Reports\CustomerList.vrw" EXPORTFILE=c:\tmp\ik1234.rtf ALLPAGES=0 PAGE=3 -autoclose

-htmlexport "C:\Examples\DataFlex 18.0 Examples\Order

Entry\Reports\CustomerList.vrw" EXPORTFILE=c:\tmp\ik1234.html MULTIPAGE=0 PAGE=3 -autoclose

-imageexport "C:\Examples\DataFlex 18.0 Examples\Order

Entry\Reports\CustomerList.vrw" EXPORTFILE=c:\tmp\ik1234.tiff MULTIPAGE=1 TYPE=tiff PAGE=0 -autoclose

-imageexport "C:\Examples\DataFlex 18.0 Examples\Order

Entry\Reports\CustomerList.vrw" EXPORTFILE=c:\tmp\ik1234.jpg MULTIPAGE=1 TYPE=jpg PAGE=3 -autoclose

-imageexport "C:\Examples\DataFlex 18.0 Examples\Order

Entry\Reports\CustomerList.vrw" EXPORTFILE=c:\tmp\ik1234.gif MULTIPAGE=1 TYPE=gif PAGE=3 -autoclose

-print "C:\Examples\DataFlex 18.0 Examples\Order Entry\Reports\CustomerList.vrw"

-cmdfile "C:\Projects\DataFlex Reports\Studio\4.0\cmdline.ini"

[pdfexport]

report=C:\Examples\DataFlex 18.0 Examples\Order Entry\Reports\CustomerList.vrw exportfile=c:\tmp\customerlist.pdf

report=C:\Examples\DataFlex 18.0 Examples\Order Entry\Reports\CustomerList.vrw exportfile=c:\tmp\customerlist.csv

report=C:\Examples\DataFlex 18.0 Examples\Order Entry\Reports\CustomerList.vrw EXPORTFILE=c:\tmp\customerlist.xls

report=C:\Examples\DataFlex 18.0 Examples\Order Entry\Reports\CustomerList.vrw EXPORTFILE=c:\tmp\customerlist.rtf

ALLPAGES=0 PAGE=3 [htmlexport]

report=C:\Examples\DataFlex 18.0 Examples\Order Entry\Reports\CustomerList.vrw EXPORTFILE=c:\tmp\customerlist.html

MULTIPAGE=0 PAGE=3

[imageexport]

report=C:\Examples\DataFlex 18.0 Examples\Order Entry\Reports\CustomerList.vrw EXPORTFILE=c:\tmp\customerlist.tiff

MULTIPAGE=1 TYPE=tiff PAGE=0 [autoclose]

Related documents