0% found this document useful (0 votes)
226 views127 pages

Super Report Pro

Manual Para crear reportes Super Report

Uploaded by

boritxxxx
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
226 views127 pages

Super Report Pro

Manual Para crear reportes Super Report

Uploaded by

boritxxxx
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 127

SuperReport Pro™

Developer Manual

Version 3.1

e-Node
30 rue de la République
33150 Cenon
France

www.e-node.net
Copyright and Trademarks

All trade names referenced in this document are the trademark or registered trademark
of their respective holder.

SuperReport Pro is copyright e-Node SAS.

4th Dimension, 4D Compiler, 4D, 4D Server, and 4D Client are trademarks of 4D SAS.

Windows is a trademark of Microsoft Corporation.

Macintosh, MacOS and MacOS X are trademarks of Apple, Inc.


Table of Contents

Contents
Copyright and Trademarks..................................................................................................... 2
About SuperReport Pro.......................................................................................................... 7
What is SuperReport Pro, and what can I do with it?............................................................. 7
SuperReport Pro Features.................................................................................................. 8
Technical Details............................................................................................................... 8
Compatibility Information.............................................................................................. 8
Technical Support......................................................................................................... 8
Upgrading from Previous Versions of SuperReport Pro............................................................ 9
Major differences from previous versions......................................................................... 9
Updating Commands................................................................................................... 11
Obsolete Commands................................................................................................... 11
Registering SuperReport Pro......................................................................................... 12
What’s New in SuperReport Pro Version 3....................................................................... 12
Setting up SuperReport Pro.............................................................................................. 15
Installation................................................................................................................ 15
Using SuperReport Pro in Demo mode........................................................................... 15
SuperReport Pro Variables............................................................................................ 15
Registering your SuperReport Pro Licence...................................................................... 16
The Demo mode dialog................................................................................................ 17
Registering Server licenses.......................................................................................... 19
Merged licenses notes................................................................................................. 20
License types............................................................................................................. 22
Getting Started with SuperReport Pro ................................................................................... 23
Creating SuperReport Pro Areas....................................................................................... 23
Using as External Window............................................................................................ 23
Using on a 4th Dimension Form..................................................................................... 23
Basic Integration............................................................................................................ 25
Using External Window................................................................................................ 25
Using Plug-in Area...................................................................................................... 26
Programming SuperReport Pro............................................................................................. 29
Commands and Functions................................................................................................ 29
Commands................................................................................................................ 29
Functions................................................................................................................... 30
When to use the commands and functions..................................................................... 30
Anatomy of a SuperReport Pro Command...................................................................... 31
Debugger.................................................................................................................. 31
Getters and Setters..................................................................................................... 31
Properties.................................................................................................................. 32
Customizing the SuperReport Pro Area.............................................................................. 33
Extending SuperReport Pro with Scripts............................................................................. 33
Execution Cycle scripts................................................................................................ 33
Object Scripts........................................................................................................... 34
SuperReport Pro Script Limitations................................................................................ 35
Understanding the SuperReport Pro Event Cycle................................................................. 36
Dealing with multi-platform Issues.................................................................................... 37
Dealing with platform pathnames.................................................................................. 37
Dealing with Print Drivers............................................................................................ 37
HTML Support................................................................................................................ 38

3
Table of Contents

Using Custom Tag Variables......................................................................................... 39


The SuperReport Pro Execution Cycle............................................................................ 39
Printing HTML Reports (Exporting to HTML).................................................................... 39
Creating Reports Procedurally........................................................................................... 42
Printing AreaList Pro Areas with SuperReport Pro................................................................ 47
How it works.............................................................................................................. 47
Command and property............................................................................................... 47
Creating the report..................................................................................................... 48
Example.................................................................................................................... 48
Custom templates....................................................................................................... 48
Demonstration database code examples (from the AreaList Pro demo database)................. 49
SuperReport Pro Text Style Tags....................................................................................... 50
Commands by Theme......................................................................................................... 53
Using the Command Reference......................................................................................... 53
Name of the command................................................................................................ 53
Parameters................................................................................................................ 54
Result/Error Codes...................................................................................................... 54
Parameter Descriptions................................................................................................ 55
Command Description................................................................................................. 55
Examples.................................................................................................................. 55
Command Themes.......................................................................................................... 56
Access.......................................................................................................................... 56
%SuperReport................................................................................................... 56
SR_Register (RegistrationCode:T) -> result:L........................................................ 57
SR_ConvertToXML (BLOB:O; XML:T; Name:T; Callback:T) -> oldSrpError:L.............. 58
SR_LoadReport (ReportRef:L; Src:T; Options:L) -> error:L..................................... 58
SR_NewReport (ReportRef:L;Src:T;Options:L) -> error:L........................................ 59
SR_NewReportBLOB (ReportRef:L, Src:O) -> error:L............................................ 59
SR_SaveReport (ReportRef:L; DstPath/XML:T; Options:L) -> error:L........................ 60
SR_DeleteReport (ReportRef:L) -> error:L........................................................... 60
Getters......................................................................................................................... 61
SR_GetObjectXML (ReportRef:L, Ref:L, XML:T) -> error:L...................................... 61
SR_GetProperties (ReportRef:L; Ref:L; Properties:AT; Values:AT; Names:AT)
-> error:L.......................................................................................................... 61
SR_GetPtrProperty (ReportRef:L; Ref:L;id:T, Value;P) -> error:L............................ 62
SR_GetLongProperty (ReportRef:L; Ref:L; id:T) -> Value:L.................................... 62
SR_GetObjects (ReportRef:L; Ref:L; id:T; Value:AL) -> error:L................................ 63
SR_GetRealProperty (ReportRef: L;Ref:L; id:T) ->Value:R..................................... 63
SR_GetTextProperty (ReportRef:L; Ref:L; id:T) ->Value:T..................................... 64
Setters.......................................................................................................................... 65
SR_SetPtrProperty (ReportRef:L; Ref:L; id:T; Value:P) -> error:L........................... 65
SR_SetLongProperty (ReportRef:L; Ref:L;id:T; Value:L)......................................... 65
SR_SetRealProperty (ReportRef:L; inRef:L; id:T; Value:R)..................................... 66
SR_SetTextProperty (ReportRef:L; Ref:L; id:T; Value:T)........................................ 66
Objects......................................................................................................................... 67
SR_ChangeObjectParent (ReportRef:L; Ref:L; NewParent:L) -> error:L................... 67
SR_DeleteObject (ReportRef:L; Ref:L) -> error:L.................................................. 67
SR_NewObject (ReportRef:L; Ref:L; id:T; Parent:L) -> error:L................................ 68
SR_NewObjectFromXML (ReportRef:L; Ref:L; XML:T; Parent:L) -> error:L............... 68
SR_FindObjectByID (ReportRef:L; Name:T; Ref:L) -> error:L................................. 69
SR_GetParent (ReportRef:L; Ref:L; ParentRef:L) -> error:L.................................... 69

4
Table of Contents

Printing......................................................................................................................... 70
SR_OpenSession (Session:L; DstFlags:L; DstPath:T; XML:T; JobName:T; Printer:T)
-> error:L.......................................................................................................... 70
SR_OpenSessionBLOB (Session:L; DstFlags:L; DstPath:T, XML:O; JobName:T;
Printer:T) -> error:............................................................................................. 71
SR_CloseSession (Session:L) -> error:L............................................................... 71
SR_Export (Src:T;Flags:L; DstPath:T; recordDelimiter;L) -> error:L.......................... 72
SR_ExportBLOBIntoBLOB (Src:O; Flags:L, FieldDelimiter:L; BLOB:O;
RecordDelimiter:L).............................................................................................. 73
SR_ExportIntoBLOB (Src:T; Flags:L; BLOB:O; recordDelimiter:L) -> error:L............ 73
SR_Print (Src:T; Flags:L; DstFlags:L; DstPath:T; Session:L; Printer:T) -> error:L....... 74
SR_PrintBLOB (Src:O; Flags:L, DstFlags:L; DstPath:T; Session:L; Printer:T; ioCount:L)
->error:L............................................................................................................ 75
SR_PrintSettings (ReportRef:L; Options) -> error:L............................................... 76
SR_PrintIntoPICT (Src:T; Flags:L; DstFlags:L; DstArray:AP; DstFormat:L; Printer:T)
-> error:L.......................................................................................................... 76
SR_PrintBLOBIntoPICT (Src:O; Flags:L, DstFlags:L; DstArray:AP; DstFormat:L;
Printer:T) -> error:L........................................................................................... 77
Miscellaneous................................................................................................................. 78
SR_ExecuteScript (ReportRef:L) -> error:L........................................................... 78
SR_Area_SaveUndo (ReportRef:L; Operation:L) -> error:L..................................... 78
SR_Area_AddUndo (ReportRef:L; Ref:L;OldState:L) -> error:L............................... 78
SR_Area_Undo (ReportRef:L) -> error:L............................................................... 79
SR_Area_Redo (ReportRef:L) -> error:L............................................................... 79
SR_ColorPicker (Color:L; ActionValue:L) -> ok:L................................................... 79
SR_DetokenizeScript (BLOB:O) -> text:T............................................................ 80
SR_RunScript (Text:T)....................................................................................... 80
SR_RunTokenizedScript (BLOB:O)...................................................................... 80
SR_TokenizeScript (Text:T; BLoB:O) ->length:L................................................... 81
Properties by Theme........................................................................................................... 83
Area/Plugin/Event Properties............................................................................................ 85
Area Properties.......................................................................................................... 85
Plugin Properties........................................................................................................ 86
Event Properties......................................................................................................... 89
Report Properties............................................................................................................ 90
Objects......................................................................................................................... 94
Object Properties........................................................................................................ 94
Group Properties........................................................................................................ 95
Line Properties........................................................................................................... 96
Oval Properties........................................................................................................... 96
Rectangle Properties................................................................................................... 96
Picture Properties....................................................................................................... 97
Text Properties........................................................................................................... 98
Text Style Properties .................................................................................................. 99
Variable Properties.....................................................................................................100
Variable Style Properties.............................................................................................101
Field Properties.........................................................................................................102
Field Style Properties.................................................................................................103
Table...........................................................................................................................105

5
Table Properties.........................................................................................................105
Header Properties......................................................................................................106
Header Style Properties..............................................................................................106
Column Properties.....................................................................................................108
Column Style Properties.............................................................................................109
Section........................................................................................................................110
Section Properties......................................................................................................110
Header/Footer Properties............................................................................................111
Section Break Properties.............................................................................................112
Watermark Properties.................................................................................................113
Guide Properties............................................................................................................113
Style Properties.............................................................................................................114
Data Source Properties...................................................................................................115
Appendixes.......................................................................................................................118
Appendix 1: Troubleshooting...........................................................................................118
Localised Formats......................................................................................................118
Appendix 2: Frequently Asked Questions..........................................................................119
Appendix 3: Hints and Tips.............................................................................................123
Quotes and Double Quotes..........................................................................................123
Printing....................................................................................................................123
Section Markers.........................................................................................................123
Windows Preview.......................................................................................................123

Index......................................................................................................125
What is SuperReport Pro, and what can I do with it?

About SuperReport Pro

What is SuperReport Pro, and what can I do with it?


SuperReport Pro is a plugin for 4th Dimension which provides an enhanced report creation
and printing tool for developers and end-users. Using the SuperReport Pro Editor and
plug-in routines, developers can create sophisticated reports that support a variety of data
formats, including 4th Dimension fields, variables, and arrays.
In addition, SuperReport Pro can be integrated into any 4th Dimension application’s user
interface, providing your users with the ability to create reports using a number of advanced
features not available using the standard reporting tool built into 4th Dimension.
SuperReport Pro's greatest benefit is the fact that it provides the ability for users to
create and modify report designs long after a 4D database application has been completed
without requiring any code changes to the database. This benefit is further enhanced in
the case of compiled databases, where SuperReport Pro allows reports to be changed
without requiring either database changes or recompilation.
SuperReport Pro reports can be held as documents on disk, or be contained within the data
file belonging to the database. Thus vertical market applications sold to many customers
can be supplied with standard reports, which can later be customized by the user. Since
these reports are held in the data file, program updates installed at a later date will have
no impact on the users' systems - the same program update can be sent to all users and
each user's customized reports are preserved!

SuperReport Pro's power does not come at the expense of simplicity. Most users will be
able to grasp the concepts involved in designing reports, since the editor is so similar to a
drawing program. Report operations like break processing, which can be cumbersome and
complex in 4D, are also made simpler, with the user able to specify when breaks occur and
which objects are to be totalled, without requiring any code.

7 About SuperReport Pro‌


SuperReport Pro Features

SuperReport Pro Features


SuperReport Pro includes a wide variety of features for creating fully customizable reports.
Using the full-featured plug-in area, you can quickly and easily enhance your application's
reporting capabilities.
If the standard functionality is not enough, you can take advantage of the complete
developer API to further extend the power of SuperReport Pro.
Included in SuperReport Pro™ are the following features:

• Compatibility with 4D v11 SQL, v12, and v13, including 64-bit 4D Server on
Windows. Note: On Mac, only Intel processors are supported.
• Include a full-featured reporting tool in any application, quickly and easily
• Enhance reporting capabilities using the SuperReport Pro developer API
• Complete support for creating HTML formatted reports
• Repeating objects for printing related many records
• Supports printing 4th Dimension arrays, including direct access to specific array
elements
• Support for executing callback routines and object scripts when printing reports
• Support for executing custom scripts for enhanced script management
• Support for custom structure views – great for isolating which tables and fields
the user can access
• Developer API for customizing end-user functionality
• Enhanced Editor Customization
• Print SuperReport Pro areas, or save them as HTML

Technical Details

Compatibility Information
SuperReport Pro Version 3 is compatible with 4th Dimension v11, v12, v13 and above, for
both Macintosh and Windows. It requires Mac OS 10.5 or higher and Windows XP SP2 or
better.

Technical Support
Technical support for SuperReport Pro is provided electronically via e-mail or our online
support reporting system. You are encouraged to use the online web reporting form as it
will be correctly routed to the appropriate support personnel.
www.e-node.net

8 About SuperReport Pro‌


Upgrading from Previous Versions of SuperReport Pro

Upgrading from Previous Versions of SuperReport Pro


SuperReport Pro Version 3 is compatible with 4th Dimension versions 11 and above.
To upgrade to SuperReport Pro Version 3.1, simply install it as described in the Installation
section of this manual, replacing your older version.

Major differences from previous versions

Compatibility Mode
You do not have to update all your SuperReport Pro areas and code immediately;
SuperReport Pro version 3 will automatically run in compatibility mode.

Compatibility Mode Behaviour


When running in compatibility mode, the following behaviours are different:
1. SR RELATIONS sets compatibility mode on (in SuperReport Pro 3 it is a
persistent property of a report, not a global one). In compatibility mode
SRP_DataSource_RelateOne and SRP_DataSource_RelateMany are ignored in
the report; the global settings are used

2. SR Set Script Callback when used with area = 0 sets compatibility mode on
(in SuperReport Pro 3 it is a persistent property of the report, not a global one).
In compatibility mode, SRP_DataSource_Callback in the report is ignored; the
global setting is used.

What’s Changed

Native Look
Now the appearance is always native.

New API
SuperReport Pro version 3 introduces a completely new API which is based on a full list of
properties that the developer can get/set.
There are now fewer commands that you use to set and get an area’s properties. Each
command affects just one property for the area, making your code much easier to
understand and debug.
The new commands are organised into themes which relate to a particular part of the
SuperReport Pro area, and some miscellaneous Utility commands.
For each theme there is a group of “Getter” functions and “Setter” commands, each
targeting a different property type.

9 About SuperReport Pro‌


Upgrading from Previous Versions of SuperReport Pro

For example, you can use the SR_GetRealProperty command to get the value of a
property that has a real number value as its result.
Note that Boolean properties are called as longints (1 = True, 0=False).
Don’t worry though - you will not need to re-write all your SuperReport code.
Most of your existing commands will still work; the old commands act as wrappers for the
new ones. In fact you will still be able to write new code using the old commands, but if
you want to take advantage of the new features, you’ll need to use the new commands.
Some of the old commands are now obsolete or are no longer relevant and should be
removed from your code.
These are listed in the table below, along with details about how they should be replaced,
where appropriate.
You can find a description of the new syntax in the Anatomy of an SuperReport Pro
Command topic.

Saving Reports - now in XML


Looking at historical versions of SuperReport Pro, the earliest version saved reports as
picture files. This was subsequently replaced with BLoBs, and now, in Version 3, they are
saved as XML.
You can use the SR_ConvertToXML command to convert existing reports from the old BLoB
format into the new XML one. Note: SR_ConvertToXML is used internally when needed
- you don't have to convert all old reports to use them.
SR_SaveReport creates an XML file or fills a variable with XML.

10 About SuperReport Pro‌


Upgrading from Previous Versions of SuperReport Pro

Updating Commands
The new API supports many more options and object types. You may want to replace calls
to old functions with their new versions. Following are some examples:

Old Command How to replace it


SR Get Scripts Use the SR_GetPtrProperty command with the appropriate property
depending on the type of object. For example, to get a field script:

$error:=SR_GetPtrProperty (vSRArea;lSR_ObjID;SRP_Field_Script;
->tSR_ObjScript)

or to get a column's script:

$error:=SR_GetPtrProperty (vSRArea;lSR_ObjID;SRP_Column_Script;
->tSR_ObjScript)

(See the Properties by Theme section for a list of all properties.)


SR Get Object Properties Use SR_GetPtrProperty with the appropriate property - for example, to
get the position of the top of an object:

lSR_ObjTop:=0
$error:=SR_GetPtrProperty (vSRArea;lSR_ObjID;SRP_Object_PosTop;
->lSR_ObjTop)

You can find a list of all the object property options in the Object
Properties section.
SR Get Sections Use SR_GetPtrProperty with the appropriate property. For example, to
get the name of a section:

lSR_SectName:=""
$error:=SR_GetPtrProperty (vSRArea;lSR_ObjID;SRP_Section_Name;
->lSR_SectName)

You can find a list of all the section property options in the Section
Properties section.

Obsolete Commands
If you are using any of the following commands, you will need to remove them from your
code or modify them as explained in the Comments:

Old Command Comments


SR Print PICT Does not use recDelim argument.
SR File Types Supports only Windows extensions (Creator/Type is not used on
Mac anymore).
SR RELATIONS Sets compatibility mode on (in SuperReport Pro 3 it is a
persistent property of the report, not a global one).
SR Set Script Callback When used with area = 0 sets compatibility mode on (in
SuperReport Pro 3 it is a persistent property of report, not a
global one).
SR SetPrinter Does not check for valid printer name.

11 About SuperReport Pro‌


Upgrading from Previous Versions of SuperReport Pro

Old Command Comments


SR Print Disk & SR Print HTML SR Print Disk does not use recDelim argument.

SR Power Menu Not implemented.


SR Package Returns 0 and invokes the debugger if this has been enabled.
SR Get Free Memory Not implemented.
SR SWAP HANDLES Not implemented.

Registering SuperReport Pro


The SR_Register command takes just one parameter, and it returns 0 if successful and
an integer between 1 and 8 if not OK. There is a list of the error codes and their meanings
here.

What’s New in SuperReport Pro Version 3

Adjust Object Size by Style


A new menu item Object -> Adjust Object Size by Style computes an object's height
according to the style specified for that object. In SuperReport 2 when you resized a text,
variable, or field object, the height was adjusted to show full line(s)); in Superreport Pro
3 you have to do it manually. The keyboard shortcut is shift-double-click.

Count Pages
A count pages option (SRP_Report_CountPages) has been added, so now you can use
"Page 1 of 9" for example (however, note that the report is processed three times).

Dynamic Text
Text objects can use "<% [+] [=] variable [ ; format ] %>" when SRP_Text_Dynamic = 1

Group object
Objects can now be grouped together by selecting them and clicking on the Group Object
tool in the toolbar.

HTML Export
The HTML export has been improved.

Multiple headers/footers
A multiple headers/footers option has been added (first page/second+ pages/last page).
To function properly on the last page, SRP_Report_CountPages must be set to 1 (if count
pages is 0, it will never print).

12 About SuperReport Pro‌


Upgrading from Previous Versions of SuperReport Pro

Native drawing of Text


SuperReport Pro uses CoreText on Mac and GDI+ on Windows. This restricts the version of
OS that SuperReport Pro can run on: SuperReport Pro version 3.1 requires Mac OS 10.5
or higher and Windows XP SP2 or newer.
Only fonts and font faces supported by these technologies can be used in SuperReport Pro.
In particular, GDI+ does not support non-TrueType fonts on some Windows versions.

Multi-style (attributed) text


SuperReport Pro now supports the multi-styled text feature of 4D v12 and above.

Object Properties
Objects have new properties - name, id - which can be used in XML/HTML exports.

Scripts
Scripts now support flow control structures (but you must not use local variables).
Scripts are stored tokenized, eliminating problems between various localized 4D versions
(e.g. the English version no longer fails to run the French demo due to the command
names).

Table object
A new object has been added to the toolbar: the Table Tool. Use this to create tables within
your report.

Unicode
SuperReport Pro supports Unicode for display and data entry. Note that filters were not
changed to support Unicode, so their functionality is limited to Roman characters.
In other words, if a filter is specified, non-Roman characters cannot be entered.

Watermark section
A Watermark section has been added. The watermark will be printed on every page, either
underneath or on top of all other printing.

XML
An area’s settings can be saved as XML into a variable or field. Note that if 4D is run in
non-Unicode mode, the size of any text is restricted to 32k characters. This may be enough
as long as you don't have any large pictures in the report, however, it is recommended
that you use the application in Unicode mode. Use the old commands for loading/saving
reports (using BLoBs) if you have to run in non-Unicode mode.

13 About SuperReport Pro‌


Upgrading from Previous Versions of SuperReport Pro

Unlimited Undo/Redo support


SuperReport Pro supports unlimited undos and redos for all user actions (to be precise, up
to 65536 possible consecutive actions).

Other Improvements
You'll also notice many additional little improvements and new features such as "center
object on page", "bind object to bottom of a group/section", "print break footer at bottom
of page, not below body", and other goodies.

14 About SuperReport Pro‌


Setting up SuperReport Pro

Setting up SuperReport Pro

Installation
SuperReport Pro is provided as a bundle for both Windows and Mac OS: there is just one
version for both platforms, including Windows 64-bit. To install it, simply copy the file
SRP.bundle into your Plugins folder.
Plugins folders can be located in one of two locations:
• In the 4D application folder (4th Dimension or 4D Server). When plugins are
installed in this location, they will be available to every database that is opened
with that application.
• Next to the database structure file for your project: In this case, the plugin will
only be available to that database. On Mac OS, this means that the Plugins folder
must be placed within the database package. To open the package, ctrl-click on
the package and choose Show Package Contents from the contextual menu.

Using SuperReport Pro in Demo mode


You can use SuperReport Pro in Demo mode for 20 minutes, after which time it will cease
to work. When this becomes annoying, it’s time to buy a license, which you can do on our
website.
Licenses are either linked to the 4D product number, the workstation, or the company
name as described In the SuperReport Pro Licence Types section. The Demo mode dialog
includes all relevant information to obtain your license, as well as a “Copy” button to put
this information into your clipboard or a text file.

SuperReport Pro Variables


There are a number of internal variables used by SuperReport Pro. Following is a description
of each variable and their usage during reporting operations.
In addition, each of these variables can be used in any callback procedure which is executed
by SuperReport Pro during a printing operation.
Variable Name Data Type Description
SRArea C_LONGINT Current report area reference (can be used in callback scripts).
SRDate C_DATE Contains the current date.
SRTime C_LONGINT Contains the current time.
SRObjectID C_LONIGNT Contains the current object for which you have a script attached.
SRPage C_LONGINT Contains the current page.
SRRecord C_LONGINT Contains the current record number or iteration value.

15 Getting Started with SuperReport Pro


Setting up SuperReport Pro

Registering your SuperReport Pro Licence


Once you have purchased your licence, you will receive a registration key. This code must
be registered each time the database is started.
There are three ways to register your license: in your 4D code with a command, using the
Demo mode dialog “Register” button, or though a text file.

Using SR_Register
1. Open the On Startup database method
2. Call the SR_Register function with your registration key - for example:
$result:=SR_Register("YourRegistrationKey") // result = 0 means registration was successful

If you have several licenses for different 4D setups you can call SR_Register multiple
times in a row without further testing.

16 Getting Started with SuperReport Pro


Setting up SuperReport Pro

The Demo mode dialog


The Demo mode dialog is displayed upon the first call to SuperReport Pro (through a
command).
Note that calling SR_Register with any key (valid or invalid) is the only call to SuperReport
Pro that will not display the dialog.
To trigger this display and enable your users to register without actually calling a command
or setting up an area, pass an empty string to SR_Register and the dialog will show:
C_LONGINT ($result)
$result:=SR_Register ("") // display the dialog

The Demo mode dialog includes all relevant information to obtain your license, as well as
a “Copy” button to put this information into your clipboard or a text file, an “eMail” button
to email the information to e-Node's registration system and a “Register” button to enter
your license key once received:

17 Getting Started with SuperReport Pro


Setting up SuperReport Pro

Using the “Register” button


Clicking on this button will display a standard 4D request to enter your registration key:

Paste or drag and drop your registration key and, if correct, the plug-in will be registered
for all future uses on this workstation:

Note: if 4D does not activate the Edit > Paste menu item click Abort and Register again.

Using a text file


Alternately, you can place a plain text file into your 4D Licenses folder.
To open this folder from 4D use the 4D Menu Help > Update licenses, then click the
Licenses Folder button:

The text file must be called "SRP3.license4Dplugin" and be a plain text type file.
Just paste all your licenses for SuperReport Pro v3.x, one per line, e.g.:
MyLicense1
MyLicense2
MyLicense3

Any license type can be included into this document, except unlimited single user, OEM
and Partner licenses.
Note: the Demo mode dialog Register button actually does this: create the text file and
include the license key, or add the license key to the existing document, if any.

18 Getting Started with SuperReport Pro


Setting up SuperReport Pro

Mixing methods
When such a file exists in the Licenses folder SuperReport Pro will check for valid
licenses from this document as a first action before anything else (including checking any
SR_Register command).
If a valid license is included into the "SRP3.license4Dplugin" document any calls to
SR_Register will return zero (for "OK").

Therefore you can mix modes and use the text file (or Register button) as well as the
command.

Unlimited single user, OEM, temporary and Partner licenses can only be entered through the
SR_Register command.

Registering Server licenses


Similarly, server licenses can be registered from the demonstration mode dialog without
having to modify your code and use SR_Register (which of course you can do with any
license type).
In this case, the 4D Licenses folder, serial information or machine ID used will only be the
4D Server information, not the client workstation's.
Server licenses can be registered on any client workstation (remote mode), or on 4D
Server itself.

Registering in Remote mode


The server and all workstations can be registered from any single client workstation
connected to the server. As in Single user mode, the Demo mode dialog will be displayed
on a client workstation when one of the following conditions are met:
• Calling a SuperReport Pro command other that SR_Register with a non-empty
parameter
• Calling SR_Register with an empty string

Use the Copy, eMail and Register buttons just as above and your server will be registered
for all workstations.
Note that any other workstations previously connected (before registration occurred) will
need to re-connect to the server to be functional.

19 Getting Started with SuperReport Pro


Setting up SuperReport Pro

Registering on 4D Server
To directly register the server and all workstations from the server machine itself, you
need to display the Demo mode dialog on the server.
Call SR_Register with an empty string in the On Server Startup base method:
C_LONGINT ($result)
$result:=SR_Register ("") // display the dialog

Use the Copy, eMail and Register buttons just as above and your server will be registered
for all workstations.

Note that the dialog will automatically be dismissed on the server after one minute in
order not to block client connections (the server is only available to client workstations
once the On Server Startup method has completed).

Merged licenses notes


Both methods can be either used with regular or merged servers and client workstations.
• Regular licenses are linked to the 4D Server serial information
• Merged licenses are linked to the 4D Server machine ID

Note that merged licenses will keep working if your 4D Server serial information is modified
(upgrading or 4D Partner yearly updates), or if any client workstation hardware is changed.
It will only have to be updated if the 4D Server hardware is changed, or if the plugin itself
requires a new key (paid upgrades upon major version changes).

You may want to register your merged server without having to turn off the database to
modify the code. We have created a utility database to manage this - it's called Get Serial
Info and you can download the appropriate version for your 4D version from the e-Node
server.

20 Getting Started with SuperReport Pro


Setting up SuperReport Pro

This is possible using any 4D setup on the server machine (such as a standard developer
single user 4D). Keeping your production server alive, open the Get Serial Info database
with 4D on the same server machine. Ignore the demonstration mode dialog (if your
single user 4D is not registered for the plugin) and wait for the next Alert:

A text file is also saved with the same information. The last line “Machine ID” is the number
that you need to send in order to receive your merged server registration key.

21 Getting Started with SuperReport Pro


Setting up SuperReport Pro

License types
Eight license types are available:
• Single-user license. This license allows development (interpreted mode) or
deployment (interpreted or compiled mode) on 4D Standalone or 4D SQL Desktop.
Since the registration key is linked to a specific 4D license, you need to provide
the number returned by the 4D command GET SERIAL INFORMATION (first
parameter). A new license will be supplied for free at any time if you change your
4D version and / or get a new 4D registration key, provided that your previous
licenses match the current public version at the exchange time.
• Small server: This license allows development (interpreted mode) or deployment
(interpreted or compiled mode, including merged servers) on 4D Server with
up to 10 users. The registration key is linked to your 4D Server license just as
above, or to the server machine for merged server applications.
• Medium server. This license allows development (interpreted mode) or
deployment (interpreted or compiled mode, including merged servers) on 4D
Server with 11 to 20 users.
• Large server. This license allows development (interpreted mode) or deployment
(interpreted or compiled mode, including merged servers) on 4D Server with
over 20 users.
• Merged single user. This license is designed for single user compiled/merged
applications built with 4D Unlimited Volume Desktop (one license per workstation).
It is linked to the workstation, not the 4D serial number.
• Unlimited Single User. This license allows development (interpreted mode) or
deployment (interpreted or compiled mode) on any number of 4D Standalone,
Runtime or Engine copies that run your 4D application(s). This is a yearly license,
which expires after the date when it is to be renewed. The expiration only affects
interpreted mode. Compiled applications using an obsolete license will never expire.
• Unlimited OEM: This license allows development (interpreted mode) or
deployment (interpreted or compiled mode) on any number of 4D Servers (of
any number of users), 4D Standalone, 4D SQL Desktop or merged copies that
run your 4D application(s). This is a yearly license, which expires after the
date when it is to be renewed. The expiration only affects interpreted mode.
Compiled applications using an obsolete license will never expire.
• Partner license: This license matches 4D's annual Partner subscription and
covers all the plug-ins published by e-Node, including AreaList Pro, SuperReport
Pro, PrintList Pro and CalendarSet. A single registration key allows development
(interpreted mode) or deployment (interpreted or compiled mode) on all 4D
Standalones and 4D Servers (2 users) provided by your 4D Partner license.
No merged applications. This is a yearly license, which expires on February 1st
(same date as your 4D Partner licenses). The expiration only affects interpreted
mode. Compiled applications using an obsolete license will never expire.

For current pricing, please see the ordering page on our website.

22 Getting Started with SuperReport Pro


Creating SuperReport Pro Areas

Getting Started with SuperReport Pro


This chapter outlines the fundamentals of using SuperReport Pro, including:

• An overview of creating SuperReport Pro areas


• Customizing the SuperReport Pro area
• Extending SuperReport Pro with object scripts
• Understanding the SuperReport Pro Event Cycle
• Dealing with multi-platform issues.
• HTML support

For detailed information on using the SuperReport Pro commands, please refer to the
Command Reference section.

Creating SuperReport Pro Areas


There are two ways in which a SuperReport Pro area can be presented to your users:
1. Using the 4th Dimension Open external window command
2. Displaying a 4th Dimension form (either via a dialog or input form)

Using as External Window


If you wish to use SuperReport Pro in an external window, you simply need to call the 4th
Dimension Open external window routine:

C_LONGINT(iSR_Win)
iSR_Win:=Open external window(50;50;400;400;8;”SuperReport Pro”;”%SuperReport”)

Using on a 4th Dimension Form


The most common way of using SuperReport Pro is to place a plug-in object on your input
form or dialog. To do this:
1. Select the Plugin Area option from the tool palette on your form:

2. Draw a rectangle on the form in the size that you want your report to appear.

23 Getting Started with SuperReport Pro


Creating SuperReport Pro Areas

3. In the Properties palette, choose SuperReport Pro from the Type dropdown
menu
4. Assign a name to the object variable
Your SuperReport Pro area will look like this:

Note that if you have a field in the table that has the same name as the report variable
followed by an underscore, the comment changes:

The field must be a BLoB or Text field. Otherwise, you'll see the following comment:

For more detailed information on using SuperReport Pro on an input form, please refer to
the Tutorial section in the SuperReport Pro User Guide.

24 Getting Started with SuperReport Pro


Basic Integration

You can use the commands and functions to configure every aspect of an SuperReport Pro
area, and to get information about an area. The commands and functions are grouped into
themes such as Getters, Setters, Printing etc.

Basic Integration
SuperReport Pro can be integrated into your applications via two different methods. The
first method uses a 4th Dimension external window; the second uses a 4th Dimension form
that can be displayed in a dialog or input form.
All examples discussed in this section assume you have a custom table for storing the
various reports you create. In our examples, we’ll use the following table structure, which
is defined in the Demo Database that is supplied with SuperReport Pro:

Using External Window


Using the 4th Dimension Open external window command, you can display the
SuperReport Pro editor in a fashion similar to the New process command.
1. Open the SuperReport Pro editor in an external window using the following code.
C_LONGINT(iSR_Win)
iSR_Win:=Open external window(50;50;Screen width-50;Screen height-50;8;”New
Report”;”%SuperReport”)

When you display SuperReport Pro in an external window, you should use a Window type
of 8 so that the window can be resized by the user and the close box is available. If you
use a modal window (type 1 or type 5), the user will not be able to close the window.
2. If you wish to communicate with the SuperReport Pro editor in an external
window, you can use the window reference (iSR_Win) as the area reference
parameter for those routines which interact with the plug-in area.

C_TEXT(tReportDoc)
tReportDoc:=”Hard Disk:myReport.srp”
iSR_Err:=SR_NewReport (iSR_Win;tReportDoc;1)

25 Getting Started with SuperReport Pro


Basic Integration

Using Plug-in Area


The second (and most common) way to use SuperReport Pro is to place the plug-in area
on an input form, then provide access to the input form either via the DIALOG command
or through the standard MODIFY SELECTION command (or User Mode access).

1. Create a new input form, or modify an existing input form, in which you wish to
display the SuperReport Pro plug-in area.
2. Create a new plug-in object using the 4th Dimension Object List:

3. Select the SuperReport Pro object from the Plug-in Area popup menu to create
a SuperReport Pro area.

4. Assign a name to your variable, which will be used by the related SuperReport
Pro command to reference your report area.

If you define the name of the report area which is the same name followed by an underscore
of a field which is in the table which contains the form you have created, SuperReport Pro
will automatically load and save the report when the record is loaded.

26 Getting Started with SuperReport Pro


Basic Integration

For example, if you have a field entitled [Reports]ReportData_ when creating the
SuperReport Pro area, using a name of “ReportData” will instruct SuperReport Pro to
automatically load/save the report when the record is loaded and the form is displayed.
The type of this field should be a BLoB field.
If you are using the auto save feature of SuperReport Pro, you may proceed to Step 7.
If you are not using a “report” table, you will need to procedurally load/save the reports
using the appropriate SuperReport Pro routines (Step 5 and Step 6).
5. The next step is to create the report data so that your users can access it. The
first If test determines if it's a new record. If so, we create a new report using
the SR_LoadReport command. If it's an existing record, we load the data from
the saved report record with SR_ParseReport (we’ll cover how to save report
data in a bit).

C_LONGINT($err)
Case of
:(Form event=On Load)
If (Is new record([Customer])) // it's a new record
$err:=SR_LoadReport (vSRArea;SR_GetTextProperty (0;0;SRP_Area_NewReport))
Else
$err:=SR_LoadReport (vSRArea; BLOB to text ([RM_Reports]RM_ReportData;
UTF8 Text without length))
End if
End case

At this point, we are ready to begin using the SuperReport Pro editor. However, before we
proceed, let’s add the code necessary for saving your report information to our report data
field so that we can access it again.

6. The last step we need to complete is saving our reports to the SuperReport
Pro data field. The easiest way to do this is to make sure you have a field,
appropriately named, to auto-save the report (see the discussion on this topic)..

When you are retrieving information from a SuperReport Pro plug-in area, you must
use a 4th Dimension text variable; passing a text field will not work correctly. Once the
SR_SaveReport routine has completed successfully, you can copy the variable to your
storage field as we have above.

27 Getting Started with SuperReport Pro


Basic Integration

7. Now you are ready to begin using the SuperReport Pro editor. Enter the User
Mode (or however you have configured access to the Report_Mgr table) and
create a new record. You should see something similar to the following input
form:

28 Getting Started with SuperReport Pro


Commands and Functions

Programming SuperReport Pro

Commands and Functions


SuperReport Pro has its own collection of commands and functions that you use to control
your SuperReport Pro areas, to find out what actions the user has taken, and to do
whatever processing is needed as a result of those actions.

Commands
The commands are organised into themes which relate to a particular part of the
SuperReport Pro functionality: Access, Getters, Setters, Area Properties, Printing, and
Miscellaneous. The “Getter” and “Setter” commands are used to set the various properties
of the report, and to find out what the specific settings are, or what action the user has
taken. For example, you can find out the name of a specified object on a report with the
SR_GetPtrProperty "getter":

$error:=SR_GetPtrProperty (vSRArea;lSR_ObjID;SRP_Object_Name;->tSR_ObjName)

A SuperReport Pro command syntax looks like this:

SR_Export (Src:T; Flags:L; DstPath:T)


Each parameter is followed by a colon and a letter indicating the type of data required for
that parameter:
:L - longint
:O - BLoB
:R - real
:T - text
:Y - array
:Z - pointer

Note that Boolean values are passed or returned as longints, where 1 = true and 0 = false.

You can find complete descriptions of the commands, along with examples, in the Command
Reference section, and descriptions of all the properties in the Properties by Theme section.
The Properties by Theme section includes details of how to use each property; the Type
column tells you what type of data it requires, and this is matched to the command variant.

29 Programming SuperReport Pro


Commands and Functions

Functions
Functions return a result code when they are called. Usually this will be the information
you requested.
Their syntax looks like this:

SR_GetLongProperty (ReportRef:L;Ref:L;id:T) -> Value:L

ReportRef is the SuperReport Pro report reference


Ref is the object number you want to access:
0 means selected objects
1 refers to the report itself
Any other number refers to that specific object
For example, you can get all sections from a report using

SR_GetObjects ($report;1;SRP_ReportSections;$alObjectID)

and then access the first section's name using

SR_GetTextProperty ($report;$alObjectID{1};SRP_Object_Name)

id is a constant that tells SuperReport Pro exactly what information you want to get (see
the Properties by Theme section to find out what the possible constants are).
Value is the result that the function returns

For example, suppose we want to find out which tool the user selected. We can use the
SR_GetLongProperty "getter" function to find out:

C_LONGINT($ToolSelected)
$ToolSelected:=SR_GetLongProperty (vSRArea;1;SRP_Area_Tool)

When to use the commands and functions


All SuperReport Pro commands and functions need to be passed a reference to the area
on which they will act. Since SuperReport Pro areas are initialised in the On Load phase
of a layout, the commands must be called during this phase or afterwards; if you try to
call any SuperReport Pro commands before the form has been loaded, you’ll get an error
message because 4D does not recognise the area reference.

30 Programming SuperReport Pro


Commands and Functions

Anatomy of a SuperReport Pro Command


Each command you write must adhere to a specific syntax in order for it to be correctly
understood by SuperReport Pro. Some commands (the “getters” and the pointer variants)
return a result code: these are functions. See the Command Reference section for the
requirements for each command. You can check the result code to find out if a function
executed OK or if there was a problem and, if so, get some information about what that
problem was. For example, SR_GetProperties is a function which returns information
about all properties of the referenced report or object into two or, optionally, three text
arrays:

ARRAY TEXT($aPropID;0)
ARRAY TEXT($aPropValue;0)
ARRAY TEXT($aPropName;0) // (this is the optional one)
$error:=SR_GetProperties (SRArea;0; $aPropID;$aPropValue;$aPropName)

If the function executed successfully, $error will be 0; if not, $error will contain an error
number. You can check the meanings of the error codes in the Result Codes list.
Every command consists of the command name followed by two or more parameters.
The first parameter is always a reference to the SuperReport Pro area. For example, the
SR_SetRealProperty command sets a specific property that requires a real number:

SR_SetRealProperty (SR_AREA;1;SRP_Report_Scale;$reportScale)

This command sets the scaling for the SuperReport Pro SR_AREA to the value specified in
the $reportScale variable.
Commands that get or set properties for an object all include the property that you want
to affect, and a value to use to specify an option (if it’s a “setter”) or to receive the result
(if it’s a “getter”). See the section on Getters and Setters, below.
All SuperReport Pro commands are described in the Command Reference section along
with examples of how to use them.

Debugger
When the SRP_Area_TraceOnError property is set to True (the default), if there is an error
in a command that does not return an error code, and you are using 4D in interpreted
mode, the 4D debugger window will automatically open with the line immediately following
the problem line highlighted.

Getters and Setters


Most of the commands are either “getters” or “setters”: they either get information
about a specific property, or they set a specific property. The Getters and Setters are

31 Programming SuperReport Pro


Commands and Functions

each available in five variants, which allow for the different data types of the properties:
Longinteger, Pointer, Real, Text, and Arrays.
For example, to set the "show ruler" property for a report, you use the SR_SetLongProperty
command along with the SRP_Report_ShowRuler property:

SR_SetLongProperty (SR_AREA;1;SRP_Report_ShowRuler;1)

The pointer options (SR_GetPtrProperty and SR_SetPtrProperty) must be used to


manipulate pictures and BLoBs. Also, they enable you to use just one version of the
command for getting and setting all the relevant properties; you pass a pointer to the
variable instead of the actual value.
A typical Getter has the following syntax:

SR_GetLongProperty (ReportRef:L;Ref:L;id:T) -> Value:L

Command Part What it is Comments


SR_Command Command name Tells SuperReport Pro what you want to do.
ReportRef Name of the Value of the variable you gave the SuperReport Pro
SuperReport Pro area area on the form, or
the value you got from SR_NewReport in the first
parameter, or
the value of $1 in callbacks.
Ref Tells SuperReport 0 = selected objects
Pro which part of the 1 = the report itself
report you want to get Any other number = a specific object.
information about
id The property that you See the Properties by Theme chapter for information
want to get information about the properites you can get and set.
about
Value Result The result of the command.

Example
Let’s suppose that we want to find out which tool the user has selected. You can use the
SR_GetLongProperty getter along with the SRP_Area_Tool property:
C_LONGINT($toolId)
$toolId:=SR_GetLongProperty (MyReport;1;SRP_Area_Tool)

Properties
Each command theme has its own set of properties that can be used to get or set various
aspects of the area, and for each property a 4D constant has been defined.
You’ll find a complete reference in the Properties by Theme section.

32 Programming SuperReport Pro


Customizing the SuperReport Pro Area

Customizing the SuperReport Pro Area


There are a variety of ways you can customize the SuperReport Pro area to suit your
application's needs. For example, you may want to disable access to the Scripting option
for end-users, or hide the menu altogether. These options are controlled through the use
of the "setter" commands and the appropriate properties.
We will give a few examples below; you can find full details of the available properties in
the Properties by Theme section.

In your form's On Load event, call one or more of the Setter commands with the properties
you want to set.

The following example will hide SuperReport Pro's ruler:


SR_SetLongProperty ($SR_AREA;1;SRP_Report_ShowRuler;0)

The following example will disable the zoom window:


SR_SetLongProperty ($SR_AREA;1;SRP_Report_ShowZoom;0)

This example will set the report's scale to 50%:


SR_SetRealProperty ($SR_AREA;1;SRP_Report_Scale;.5)

Extending SuperReport Pro with Scripts


You can add scripts to your SuperReportPro reports and to objects on a report.

Execution Cycle scripts


Scripts can be added to the start of the report, the body, and the end of the report. To add
one of these, choose Scripts from the Database menu, and then select one of the three
sub-menu options:

The checkmark next to the Start Script ... option in this example indicates that a Start
Script has been added.
You can find an example of using scripts in the Tutorial section of the User Manual.

33 Programming SuperReport Pro


Extending SuperReport Pro with Scripts

Object Scripts
Like standard 4th Dimension reports created using the Form Editor, SuperReport Pro objects
may contain scripts which may call any 4th Dimension command, method, or 3rd Party
plug-in routine. Using SuperReport Pro scripts, you can further customize your reports to
produce output which cannot be created using standard SuperReport Pro objects.
For example, let’s say you wanted to create a report with a listing of sales, broken down
by customer, and provide an average sale for each customer as well as an overall invoice
average. While SuperReport Pro can handle most of these tasks for you, utilizing the
advanced break processing capabilities built-in to SuperReport Pro, the extended averaging
requirements would not be possible without the support of object scripts.
Using SuperReport Pro’s object scripts, you can place custom code on just about any
SuperReport Pro object, including section lines, providing a very complete and flexible
reporting system.

34 Programming SuperReport Pro


Extending SuperReport Pro with Scripts

To add a script to an object, double-click on the object. The object properties dialog will
open; the exact contents of the dialog vary depending upon the type of object, but they
will all have a Script option. For example, the Field Properties dialog looks like this, with
the Script tab selected:

SuperReport Pro Script Editor

SuperReport Pro Script Limitations


While SuperReport Pro provides the ability to easily create custom scripts, there are a few
limitations that you should be aware of when creating your scripts.
1. SuperReport Pro scripts are not executed in compiled form, regardless of your
application's compiled status. While this typically won’t be a noticeable issue,
you should be aware that scripts are slower than compiled code.
2. All scripts are executed in the same fashion as if the 4th Dimension EXECUTE
command had been called.

35 Programming SuperReport Pro


Understanding the SuperReport Pro Event Cycle

3. When selecting a table or field which has been customized (using SuperReport
Pro’s structure customization feature), the script editor will display the actual
table/field information as configured at the structure level.

Understanding the SuperReport Pro Event Cycle


Due to the extensive reporting features offered by SuperReport Pro, there is the potential
for some level of confusion for even the seasoned 4th Dimension programmer. The following
information outlines the standard SuperReport Pro Event Cycle.

SuperReport Pro generates reports in the following sequence (in pseudo-code):

Execute StartProcedure
Determine how many iterations are required
While (Current Iteration < Maximum Iterations) do
Execute BodyProcedure
If (Break Values have changed)
Process appropriate SubHeader sections
Process appropriate SubTotal sections
End if
Process Body section
End while
Process Total section
Execute EndProcedure

Section Processing
In processing any section, the following sequence of events takes place:

Execute section script


For (i = 1 to number of objects in this section) do
Execute object script
Get object (field/variable/array) value
End for

36 Programming SuperReport Pro


Dealing with Multi-Platform Issues

Dealing with multi-platform Issues


Fortunately, SuperReport Pro does a good job of conditionally handling most multi-
platform issues. However, there are some cases when some additional developer control
is necessary to support multi-platform issues:
• Dealing with platform pathnames
• Dealing with Print Drivers

Dealing with platform pathnames


All Macintosh files use a directory delimiter of “:” (ASCII 58), while Windows directories
are delimited with a “\” character. One approach to dealing with these differences is to use
a 4th Dimension variable, which contains the delimiter.

$delim:=Char(58) `default, Macintosh delimiter


If(IsWindows)
$delim:=Char(92)
End if

Then you could use the 4th Dimension function Application file or Structure file to return
the pathname to either the application or structure file as a starting point to determine the
pathname to a “Reports” directory.
For some useful routines for obtaining the parent pathname for an application or structure
file, refer to the 4th Dimension Language Reference.

Dealing with Print Drivers


Due the large number of print drivers available, configuring reports for most printers can
be a very difficult task. Following is a list of some tips which can make designing your
reports a manageable job.
1. Try to leave at least 1/4” margin on the edges of your reports to account for a
wide variety of print drivers
2. Stick with common fonts.
3. Be careful of using enhanced font formatting attributes such as Bold, Italic,
Underline, etc. While most print drivers can handle multiple styles for a single
object, some print drivers have problems dealing with multiple styles.
4. Test, test, test! Try to test your reports on as many different printers as possible…
you would be surprised at the differences between drivers.
If you have a tip that would be useful to other SuperReport Pro users, please let us know
so that we can post this information in future documentation and release notes, as well as
on our web site.

37 Programming SuperReport Pro


HTML Support

Send tips to: [email protected]

HTML Support
SuperReport Pro provides the ability to create standard HTML reports.
Each SuperReport Pro object may contain custom HTML tags, which are inserted before
and after the corresponding data object is sent to the HTML file when printing the report
in HTML format.

Using the HTML Tag Dialog, you can supply the following items:
• Begin Tag
The begin tag information is sent to the HTML file before the corresponding data
is sent to the file.
• End Tag
The end tag information is sent to the HTML file after the corresponding data is
sent to the file.

38 Programming SuperReport Pro


HTML Support

Using Custom Tag Variables


In addition to entering static HTML tags in the HTML Dialog, you can also embed custom
HTML tag variables, which are actually 4th Dimension variables which may contain any
valid HTML tag (or group of tags).
For example, if you have a set of HTML tags which you insert at the beginning of all your
HTML files, you could place all the HTML data into a 4th Dimension variable, then reference
the variable from within SuperReport Pro by using the custom variable tags.
To use a 4th Dimension variable within your HTML tags, enclose the variable with “<%” and
“%>” markers. When the report is printed, SuperReport Pro will take the data between
these markers, retrieve the data from the actual variable and insert it into the HTML
stream as the file is created.
Following is an example of a 4th Dimension variable that is inserted using the variable tags.

tBegTagHTML:="<html><body bgcolor='#ffffff'>" `sample start file tag


tEndTagHTML:="</body></html>" `sample end file tag

The SuperReport Pro Execution Cycle


When creating HTML reports, it is important that you understand the 4th Dimension
execution cycle as this is how you will determine when specific tags should be included so
that your HTML files will be correctly structured.
For more information on the SuperReport Pro Execution Cycle, please refer to the
Understanding the SuperReport Pro Event Cycle section earlier in this chapter.

Printing HTML Reports (Exporting to HTML)


Exporting to HTML is very similar to the XML export, using <Report>, <section>,
<variable>, <text>, <picture> and <group> tags with name and id attributes, ignoring
HTML prefix/suffix properties.
Lines, Rectangles and Ovals are not exported.
To export to HTML, use SR_Export, SR_ExportBLOB, SR_ExportIntoBLOB or
SR_ExportBLOBIntoBLOB.
Specify either SRP_Export_XML or SRP_Export_HTML (among other flags) in the second
parameter.
At the start of processing, the "header" is written:
• If the SRBegHTML variable exists and is not empty, it is written as-is; otherwise,
the standard prolog is written (declarations + <html><head><title>report
name</title></head><body>)
At the end, the "footer" is written:
• If the SREndHTML variable exists and is not empty, it is written as-is; otherwise,
the standard epilog is written (</body></html>)

39 Programming SuperReport Pro


HTML Support

Sections are written as follows:


• If the SRP_Section_HTMLPrefix property exists (is not empty), it is written as is;
otherwise, a simple <DIV> is written
• All objects are exported
• If the SRP_Section_HTMLSuffix property exists (is not empty), it is written as-is,
otherwise a simple </DIV> is written
Objects are written as follows:
• If the HTML prefix or suffix property is not empty, the prefix is written as-is,
the object is written, the suffix is written; otherwise a simple <span> is written
using the name and id attributes of the respective object, the object is written.
• Table objects are exported as HTML tables using the tags <thead><th><td> for
headers and <tbody><tr><td> for data
• Picture object exports the SRP_Picture_HTMLReplace property instead of the
actual data
• How the respective objects are written depends on the SRP_Text_Attributed
property of the object and the SRP_Export_PlainText bit in the SrcFlags of the
export command.

HTML prefix refers to SRP_Text_HTMLPrefix / SRP_Variable_HTMLPrefix/


SRP_Field_HTMLPrefix / SRP_Table_HTMLPrefix.
The HTML suffix means SRP_Text_HTMLSuffix.

NOTE: the font is not exported (SuperReportPro 2.5 did use <font face="xxx">)

40 Programming SuperReport Pro


HTML Support

There are three ways to print your reports in HTML format. The first method uses the
SuperReport Pro Editor.
1. Select Export… from the File menu.
2. Select Output As HTML File in the Output Options section:

The second method is to use the SR_Export command with the SRP_Export_HTML option
- for example:

$SR_Err:=SR_Export ($report;SRP_Export_HTML | SRP_Export_Body | SRP_Export_Breaks |


SRP_Export_Total | SRP_Export_Headers | SRP_Export_StaticText;"full path to a file to create.html")

$SR_Err:=SR_Export ($report;SRP_Export_XML | SRP_Export_Body;"full path to a file to create.xml")

$SR_Err:=SR_Export ($report; SRP_Export_Text | SRP_Export_CSVFormat | SRP_Export_Body;


"full path to a file to create.txt")

41 Programming SuperReport Pro


Creating Reports Procedurally

The third method is to use the SR_ExportIntoBLOB command - for example:

C_BLOB(oSR_Report)
SET BLOB SIZE(oSR_Report;0)
SR_ExportIntoBLOB ($Report;SRP_Export_HTML; SRP_Export_Body;oSR_Report)

See the Tutorial section in the User Guide to learn more about getting started with
SuperReport Pro.

Creating Reports Procedurally


It's possible to use SuperReport Pro commands to create entire reports procedurally. The
following example creates a report template that could be used for printing an AreaList Pro
area using the AL_SuperReport command (see the next section for more info on using
SuperReport Pro to print AreaList Pro areas).

// Start by creating a new empty report:

C_LONGINT($err;$i)
C_LONGINT($report;$section;$object)
$err:=SR_NewReport ($report;"";0)
SR_SetTextProperty ($report;1;SRP_Report_Name;"ALP")
SR_SetLongProperty ($report;1;SRP_Report_PageWidth;595) // A4
SR_SetLongProperty ($report;1;SRP_Report_PageHeight;842) // A4
SR_SetTextProperty ($report;1;SRP_Report_Margins;"12.5;12.5;12.5;12.5")

// Modify the data source:

$object:=SR_GetLongProperty ($report;1;SRP_Report_DataSource)
SR_SetLongProperty ($report;$object;SRP_DataSource_Source;SR Iterations Fixed)
SR_SetLongProperty ($report;$object;SRP_DataSource_Iterations;1)

// Create two new styles:

$err:=SR_NewObject ($report;$object;SRP_Style;0)
$err:=SR_NewObject ($report;$object;SRP_Style;0)

42 Programming SuperReport Pro


Creating Reports Procedurally

// Modify styles - the default and the two added:


ARRAY LONGINT($aStyles;0)
$err:=SR_GetObjects ($report;1;SRP_ReportStyleSet;$aStyles)
ARRAY LONGINT($aStyleIDs;Size of array($aStyles))
For ($i;1;Size of array($aStyles))
$object:=$aStyles{$i}
SR_SetTextProperty ($report;$object;SRP_Style_FontName;"Helvetica")
SR_SetRealProperty ($report;$object;SRP_Style_Size;8)
SR_SetLongProperty ($report;$object;SRP_Style_Wrap;1)
SR_SetRealProperty ($report;$object;SRP_Style_LineSpacing;1)
$aStyleIDs{$i}:=SR_GetLongProperty ($report;$object;SRP_Style_ID) // just to be sure - but
they should be 0, 1 and 2
Case of
: ($i=1) // first is the Default
SR_SetTextProperty ($report;$object;SRP_Style_Name;"Default")
: ($i=2) // second will be used for headers
SR_SetTextProperty ($report;$object;SRP_Style_Name;"Headers")
SR_SetLongProperty ($report;$object;SRP_Style_Bold;1)
: ($i=3) // third will be used for data columns
SR_SetTextProperty ($report;$object;SRP_Style_Name;"Columns")
End case
End for

// Create header section:


$err:=SR_NewObject ($report;$section;SRP_Header;0)
SR_SetTextProperty ($report;$section;SRP_Header_Name;"Header")
SR_SetLongProperty ($report;$section;SRP_Section_Height;40)
SR_SetLongProperty ($report;$section;SRP_Section_LabelPos;575)

43 Programming SuperReport Pro


Creating Reports Procedurally

// Create a Text object in the header - our title:


$err:=SR_NewObject ($report;$object;SRP_Text;$section)
SR_SetTextProperty ($report;$object;SRP_Text_Name;"Title") // this is needed for AL_SuperReport
SR_SetLongProperty ($report;$object;SRP_Text_PosWidth;570)
SR_SetLongProperty ($report;$object;SRP_Text_PosHeight;40)
SR_SetLongProperty ($report;$object;SRP_Text_VariableSizeH;1)
SR_SetLongProperty ($report;$object;SRP_Text_VariableSizeV;1)
SR_SetLongProperty ($report;$object;SRP_Text_DrawEmpty;1) // remove if empty
SR_SetLongProperty ($report;$object;SRP_Text_StyleID;0) // this should not be needed
SR_SetLongProperty ($report;$object;SRP_Text_Size;14)
SR_SetLongProperty ($report;$object;SRP_Text_BaseLineShift;3)
SR_SetTextProperty ($report;$object;SRP_Text_Data;"Some Title")
SR_SetLongProperty ($report;$object;SRP_Style_HorAlign;2) // center on page

// Create the body section:


$err:=SR_NewObject ($report;$section;SRP_Body;0)
SR_SetTextProperty ($report;$section;SRP_Section_Name;"Body")
SR_SetLongProperty ($report;$section;SRP_Section_Height;40)
SR_SetLongProperty ($report;$section;SRP_Section_LabelPos;575)

// Create a Table object in the body - the table which will be filled by AL_SuperReport
$err:=SR_NewObject ($report;$object;SRP_Table;$section)
SR_SetLongProperty ($report;$object;SRP_Text_PosWidth;570)
SR_SetLongProperty ($report;$object;SRP_Text_PosHeight;40)
SR_SetLongProperty ($report;$object;SRP_Table_NumHeadings;1) // one line in header - this
should not be needed
SR_SetLongProperty ($report;$object;SRP_Table_NumColumns;1) // one column - this should not
be needed
SR_SetLongProperty ($report;$object;SRP_Text_Align;2) // center on page
ARRAY LONGINT($aObjects;0)
$err:=SR_GetObjects ($report;$object;String(1;SRP_TableHeaderRowMask);$aObjects) // get the
first header line objects
SR_SetLongProperty ($report;$aObjects{1};SRP_Style_StyleID;1)
$err:=SR_GetObjects ($report;$object;SRP_TableColumns;$aObjects) // get the columns
SR_SetLongProperty ($report;$aObjects{1};SRP_Header_StyleID;2)

44 Programming SuperReport Pro


Creating Reports Procedurally

// Create the footer section


$err:=SR_NewObject ($report;$section;SRP_Footer;0)
SR_SetTextProperty ($report;$section;SRP_Section_Name;"Footer")
SR_SetLongProperty ($report;$section;SRP_Section_Height;13)
SR_SetLongProperty ($report;$section;SRP_Section_LabelPos;575)

// Create a Variable object in the footer - Date:


$err:=SR_NewObject ($report;$object;SRP_Variable;$section)
SR_SetTextProperty ($report;$object;SRP_Variable_Source;"SRDate")
SR_SetLongProperty ($report;$object;SRP_Variable_PosTop;3)
SR_SetLongProperty ($report;$object;SRP_Variable_PosWidth;200)
SR_SetLongProperty ($report;$object;SRP_Variable_PosHeight;10)
SR_SetLongProperty ($report;$object;SRP_Text_VariableSizeV;1)
SR_SetLongProperty ($report;$object;SRP_Text_Align;1) // left on page
SR_SetLongProperty ($report;$object;SRP_Header_StyleID;0) // this is the default

// Create a Variable object in the footer - Page


$err:=SR_NewObject ($report;$object;SRP_Variable;$section)
SR_SetTextProperty ($report;$object;SRP_Variable_Source;"SRPage")
SR_SetLongProperty ($report;$object;SRP_Variable_PosLeft;470)
SR_SetLongProperty ($report;$object;SRP_Variable_PosTop;3)
SR_SetLongProperty ($report;$object;SRP_Variable_PosWidth;100)
SR_SetLongProperty ($report;$object;SRP_Variable_PosHeight;10)
SR_SetLongProperty ($report;$object;SRP_Text_VariableSizeH;0x0001)
SR_SetLongProperty ($report;$object;SRP_Text_VariableSizeV;1)
SR_SetLongProperty ($report;$object;SRP_Text_Align;3) // right on page
SR_SetLongProperty ($report;$object;SRP_Header_StyleID;0) // this is the default

// Clear page setup (automatically created):


C_BLOB($blob)
$err:=SR_SetPtrProperty ($report;SRP_Report_PageFormat;->$blob) // Mac
$err:=SR_SetPtrProperty ($report;SRP_Report_PrintSettings;->$blob)
$err:=SR_SetPtrProperty ($report;SRP_Report_DevMode;->$blob) // Win
$err:=SR_SetPtrProperty ($report;SRP_Report_DeviceNames;->$blob)

45 Programming SuperReport Pro


Creating Reports Procedurally

// Get the XML and destroy the report


C_TEXT($xml)
$err:=SR_SaveReport ($report;$xml;0)
$err:=SR_DeleteReport ($report)

// test it
C_LONGINT($win)
$win:=Open external window(100;100;800;800;Plain form window;"SRP";"%SuperReport")
$err:=SR_LoadReport ($win;$xml;0)

46 Programming SuperReport Pro


Printing AreaList Pro Areas with SuperReport Pro

Printing AreaList Pro Areas with SuperReport Pro


SuperReport Pro v3 can also be used in conjunction with AreaList Pro version 9.4 and
above to print AreaList Pro areas.

How it works
AreaList Pro v9.4 and above allows printing or saving as HTML through SuperReport Pro
v3. It only takes two lines of code to print an AreaList Pro area.
Additional options are available, such as automatic column width and use of SuperReport
Pro style properties instead of the existing AreaList Pro area settings.
You can either use the built-in SuperReport Pro template to print an AreaList Pro area “on
the fly” or create your own.
The AreaList Pro Demonstration database includes a “Print with SuperReport Pro” button
in the AreaList Pro > Configuration Options… dialog. It also includes a SuperReport menu,
allowing printing with the default template or a custom template, and editing / creating
your own templates.

Command and property


Use the following command to print with SuperReport Pro:

AL_SuperReport (AreaRef:L; Template:T; Options:L; StyleOptions:L; Title:T) -> result:T

Parameter Type Description


’’ AreaRef longint Reference of AreaList Pro object on layout.
’’ Template text XML SuperReport template or full path to a XML
template or empty to use AreaList Pro's built-in
template.
’’ Options longint 0 = use current columns widths; 1 = use automatic
width.
’’ StyleOptions longint Style properties that should not be overtaken by
AreaList Pro - see constants in SuperReport Pro manual,
Style Features.
’’ Title text Optional text centered in the header.
‘‘ result text

Use the following property with AL_GetAreaTextProperty to retrieve the default template
in XML format:
Constant Get Set Per Type Default Min Max Comments
ALP_Area_ text Get the SuperReport Pro template used
SRPTableTemplate for report creation (stored in Resources/
TableReport.xml) as XML

47 Programming SuperReport Pro


Printing AreaList Pro Areas with SuperReport Pro

Creating the report


Creating an XMLreport from an AreaList Pro area is performed by the AL_SuperReport
command:
AL_SuperReport (AreaRef:L; Template:T; Options:L; StyleOptions:L; Title:T) -> result:T

• Template can be an XML template or full path to an XML template or empty to


use AreaList Pro’s built-in SuperReport Pro template
• Options: 0 -> use current column widths; 1 -> use automatic width
• StyleOptions: bit-field - which style properties should not be overtaken from
AreaList Pro - see constants in SuperReport Pro Style Features
• Title: optional text centered in the header

If you want to use your own SuperReport Pro template:


• Title will replace any text in all text objects named “Title” in the first header
(must not be grouped - only direct children of the header)
• in the body section, the first table object will be filled with headers/columns;
the table must have exactly one column (used as the template for all printed
columns)

Example
$reportXml:=AL_SuperReport ($area;"";1;SRP_Style_HasFontName | SRP_Style_HasFontSize;
"My first ALP area printed using SRP")

The code above means: fill the template but don't use the font name and font size defined
in AreaList Pro (use the one stored in the template default style), columns will be auto-
sized by SuperReport Pro (because the fonts are different, the AreaList Pro widths must
be ignored)
Then use SuperReport Pro to edit the resulting report, save it, export it as HTML or print
it, e.g.:
$result:=SR_Print ($reportXml;0;SRP_Print_DestinationPreview | SRP_Print_AskPageSetup; "";0;"";0)

Custom templates
AreaList Pro’s built-in SuperReport Pro template is obtained by the
ALP_Area_SRPTableTemplate property, which gets the SuperReport Pro template that will
be used for report creation by AL_SuperReport (stored in Resources/TableReport.xml)
as XML:
$tableReportTemplate:=AL_GetAreaTextProperty (0;ALP_Area_SRPTableTemplate)
//get the built-in SRP template from ALP

Then in SuperReport Pro you can edit and save your own template anywhere (in the data
file or a document) for future use with AL_SuperReport, e.g.:
$srpError:=SR_LoadReport ($window;$tableReportTemplate;0)
// load the SRP report and display it, save the custom template somewhere with the File menu

48 Programming SuperReport Pro


Printing AreaList Pro areas with SuperReport Pro

Demonstration database code examples (from the AreaList Pro demo database)

Print with SuperReport Pro (default template)


C_TEXT($reportXml)
C_LONGINT($result)
$reportXml:=AL_SuperReport (eArea;"";0;0;vTitle)
$result:=SR_Print ($reportXml;0;SRP_Print_DestinationPreview | SRP_Print_AskPageSetup;"";0;"";0)

Print with SuperReport Pro (custom template)


C_TEXT($reportXml ;$path)
C_LONGINT($result)
$path:=Select document("";"xml";"Select a SRP template for ALP";0)
$path:=Document //we actually need the full path
If ($path#"")
$reportXml:=AL_SuperReport (eArea;$path;0;0;vTitle)
$result:=SR_Print ($reportXml;0;SRP_Print_DestinationPreview |
SRP_Print_AskPageSetup;"";0;"";0)
End if

Editing a custom template


C_TEXT($tableReportTemplate)
C_LONGINT($srpError)
C_LONGINT($window)
$tableReportTemplate:=AL_GetAreaTextProperty (0;ALP_Area_SRPTableTemplate)
//get the built-in SRP template from ALP
If ($tableReportTemplate#"")
$window:=Open external window(100;100;800;800;Plain form window;
"SuperReport Pro template for AreaList Pro";"%SuperReport") //open the window for editing
$srpError:=SR_LoadReport ($window;$tableReportTemplate;0)
// load the SRP report and display it, save the custom template somewhere with the File menu
End if //closing the window will prompt for save if modified

49 Programming SuperReport Pro


SuperReport Pro Text Style Tags

SuperReport Pro Text Style Tags


If the SRP_Variable_Attributed option has been set, special tags can also be used in any
text contained in a SuperReport Pro area to display styled characters.
These tags work just like HTML tags: <tag>styled text</tag>.

Style Tag
Bold <b>
Decrease font size by # quarters (1/4) of current size <s -#>
Increase font size by # quarters (1/4) of current size <s +#>
Inserted text <ins>
Italic <i>
Strike-through <del>
or
<SPAN STYLE='text-
decoration:line-through'>
Set font size to # points <s #>
Set font by name <f "font name">
(needs to be quoted if the name
contains more than one word)
Set color (any format can be used, e.g. <c 0xFFFF0000> <c color name>
<c 1.0,0,0> <c P123> <c dark orange>)
Underline <u> or <ins>

4D v12 (and above) internal format for styled text is stored as <SPAN STYLE="style attributes">
where the style attributes used by SuperReport Pro are:
• font-family
• font-size
• font-weight (bold/normal)
• font-style (italic/normal)
• text-decoration (underline/ line-through/none)
• color (#RRGGBB).
It is also possible to set the format as attributed, and specify the style attributes using the
SRP_Variable_Attributed and SRP_Variable_Format properties.

This feature is usable with Variable, Field and Table’s Column types objects.

50 Programming SuperReport Pro


SuperReport Pro Text Style Tags

Example:
C_TEXT($format)

SR_SetLongProperty ($area;$object;SRP_Variable_Attributed;1) // the object is "attributed"

$format:="<c  blue>+#####</c>;<i><c  red>-#####</c></i>;<s+1><c  green><b>ZERO</b></c></s>"

SR_SetTextProperty ($area;$object;SRP_Variable_Format;"$format)

With the above settings:


• Positive numbers will be printed in blue roman characters with a plus sign.
• Negative numbers will be printed in red italic characters with a minus sign.
• Zeros will be printed in green bold, font size increased by 25%, with the text
"ZERO".

Here is the result, using a repeating variable/field with that format, or as one column in a
Table object (with variable row height to hold the taller ZERO value):

Note that if the number format is too “small” to hold the number, 4D (and SuperReport
Pro) will display it as “<<<<<<<<<<<<<<<<<<”, which will interfere with the opening
tag character “<” if the column is attributed (multi-styled).
In the example above (using "## ###" as a number format), this will be the case for all
numbers exceeding 99,999.
Make sure that the format used will not cause the number to overflow, lest unexpected
results might ensue.

51 Programming SuperReport Pro


Name of the command

Commands by Theme

Using the Command Reference


Each SuperReport Pro command is described in detail in this section. Each description
contains the following elements:

Name of the Parameters


command Result or Error

SR_ConvertToXML (BLOB:O, XML:T, Name:T, Callback:T) -> SrpError:L

Parameter Type Description Descriptions of the


’’ inBLOB BLoB BLoB to convert to text. parameters
’’ outXML text XML output from the BLoB.

’’ inName text of this


A description SRP_Report_Name property.

’’ inCallback command
text SRP_DataSource_Callback property.

Convert a SuperReport Pro template from inBLOB (SRP 2.x document


or SRP 3.x XML in a blob (UTF8 or UTF16LE)) to text in XML format.
One or more
examples showing how to
Example 1 use the command
This example ....

Name of the command


This is what tells SuperReport Pro what you want to do; the command name must always
be entered exactly as shown.

53 Commands by Theme
Parameters

Parameters
Every command requires at least one parameter. Most require the first parameter to be
the area reference: this is the Variable Name that you assigned to the SuperReport Pro
area that you want the command to affect:

Result/Error Codes
Functions return a result after they have been called. Unless otherwise specified in the
parameter description table, the result codes are long integers and have the following
meanings:

Result Code Constant Description


-1 SRP_Err_Generic Generic Error
0 SRP_Err_OK OK - no error
-2 SRP_Err_CantLoadXML Can't Load XML
-3 SRP_Err_CantSaveXML Can't Save XML
-4 SRP_Err_InvalidAreaRef Invalid Report Ref
-5 SRP_Err_InvalidObjectRef Invalid Object Ref
-6 SRP_Err_InvalidRequest Invalid Request
-7 SRP_Err_InvalidArrayType Invalid Array Type
-8 SRP_Err_InvalidNilPointer Invalid Nil Pointer
-9 SRP_Err_InvalidPointerType Invalid Pointer Type
-10 SRP_Err_InvalidArraySize Invalid array size
-11 SRP_Err_InvalidSession Invalid Session Ref
-128 SRP_Err_UserCancelled User Cancelled

54 Commands by Theme‌
Parameter Descriptions

Parameter Descriptions
Each command has its own set of parameters, and they are each described in the parameter
descriptions table. The tables comprise three columns: Parameter, Type, and Description.
Parameter: The name of the parameter, as shown in the Parameter list. Each is preceded
by one of two arrows which indicate whether it is a value that you pass to the command
or one that the command returns to you:

’’ Area A value that you pass to the command


‘‘ Array A value that is returned by the command

Type: The type of the parameter. Note that if your database is running in non-Unicode
mode, text objects are limited to 32k characters.
Description: Information about the parameter

Command Description
An explanation of what the command does and how to use it.

Examples
One or more examples demonstrating how the command might be used.

55 Commands by Theme‌
Command Themes

Command Themes
The commands are organised into six themes:
Access: Commands that affect the entire SuperReport Pro area
Getters: Commands for getting information about certain aspects of the report
Setters: Commands for setting properties of objects on the report
Objects: Commands for managing the various objects on the report
Printing: Commands to manage the printing of SuperReport Pro reports
Miscellaneous: Some additional tools and utilities.

For each theme there is a set of properties that can be used with that theme’s commands.
You will find a complete list of properties in the Properties by Theme section.

Access
The commands in this theme affect the overall SuperReport Pro area.
The properties that can be used with these commands can be found in the Properties by
Theme section.
For the Area properties pertaining to areas (e.g. SRP_Area_DrawingMode), not global
settings, you can use 0 as the Area Reference to accessing the default values for all newly
initialized (or re-initialized) areas.
• ReportRef = 0 means "access workstation global settings".
• ReportRef # 0 means "access this area's settings".

ReportRef is either a Report reference (from SR_NewReport) or a SuperReport Pro area reference
Ref is the object number, where 0 = selected objects, 1 = the report itself

%SuperReport

The actual plug-in area object, which is placed on the 4th Dimension form in which you
wish to display the SuperReport Pro area.

In addition, you use the %SuperReport routine when using the 4th Dimension Open
external window function, which provides the ability to display the SuperReport Pro
editor in a standard 4D external window. For example:

iSR_Win:=Open external window(50;50;Screen width-50;Screen height-50;8;”New


Report”;”%SuperReport”)

56 Commands by Theme
Examples SR_Register

SR_Register (RegistrationCode:T) -> result:L

Parameter Type Description


’’ RegistrationCode text Pass the registration key to register your copy of
SuperReport Pro. Only one registration key is required.
The key is either linked to the 4D or 4D Server
serial number (individual licenses), or to the
workstation (merged license), or to the name of the
company / developer (unlimited annual licenses).
‘‘ result longint Result Description
code
0 OK
1 Beta license has expired
2 Invalid license
3 The license has expired
4 The OEM license has expired
5 The maximum number of users has been
exceeded
6 The license is for a different environment
(e.g. the licence is for a single-user
version, but you are using it with 4D
Server)
7 The license is linked to a different 4D
license
8 Invalid merged license

SR_Register is used to register the SuperReport Pro plug-in for standalone or server use.

You must call SR_Register with a valid registration key, otherwise SuperReport Pro will
operate in demonstration mode - it will cease to function after 20 minutes.

When SR_Register is called with an empty string, the license dialog will be displayed if
SuperReport Pro is not registered and the dialog had not yet been displayed.

Multiple calls to SR_Register are allowed. The plug-in will be activated if at least one valid
key is used, and all subsequent calls to SR_Register will return 0.
Example
C_LONGINT ($result)
$result:=SR_Register ("YourRegistrationKey")
Case of
:($result=2)
ALERT ("The SuperReport Pro licence is invalid.")
:($result=3)
ALERT ("The SuperReport Pro licence has expired.")
etc.
End case

57 Commands by Theme
Examples SR_ConvertToXML - SR_LoadReport

Alternatively to SR_Register, you can place a plain text file into your 4D Licenses folder.
Please see the Licence Types section for detailed information about the licencing options
available for SuperReport Pro.
Example with multiple calls
C_LONGINT ($result) // ignored in this case
$result:=SR_Register ("Registration key one")
$result:=SR_Register ("Registration key two")
$result:=SR_Register ("Registration key three")
etc.

If ($result#0) // registration failed


ALERT ("SuperReport Pro could not be registered.")
End If

SR_ConvertToXML (BLOB:O; XML:T; Name:T; Callback:T) -> oldSrpError:L

Parameter Type Description


’’ inBLOB BLoB BLoB to convert to text.
‘‘ XML text XML output from the BLoB.

’’ Name text SRP_Report_Name property.

’’ Callback text SRP_DataSource_Callback property.

Convert a SuperReport Pro report template from BLoB (SuperReport Pro 2.x document or
SuperReport Pro 3.x XML in a blob (UTF8 or UTF16LE)) to text in XML format.
Note: SR_ConvertToXML is used internally when needed - you don't have to convert all
old reports to use them.
Example
Convert a report that has been saved in a BLoB field into XML:
C_TEXT(tReportXML)
$err:=SR_ConvertToXML([Reports]ReportBlob;tReportXML;"MyReport";CallbackMethod)

SR_LoadReport (ReportRef:L; Src:T; Options:L) -> error:L

Parameter Type Description


’’ ReportRef longint Report reference.
’’ Src text The saved report to open.

’’ Options longint rc="", Options=1: empty path, ask for file


S
Src="<?xml@", Options is irrelevant: XML
otherwise Src is a path to load the report from.

Open a saved report and display it in the report area.

58 Commands by Theme
Examples SR_NewReport - SR_NewReportBLOB

Example
This example opens a report that has been saved in a BLoB field:
$report:=BLOB to text([Reports]ReportBlob;UTF8 text without length)
If (Length($report)>0)
$err:=SR_LoadReport ($ReportArea;$report;0)
End if

SR_NewReport (ReportRef:L;Src:T;Options:L) -> error:L

Parameter Type Description


‘‘ ReportRef longint Report reference.
’’ Src text Name of report template to load.

’’ Options longint Src="", Options=0: empty XML


Src="", Options=1: empty path, ask for file
Src="<?xml@", Options is irrelevant: XML
otherwise Src is a path to load the report from.
Create a new offscreen report, optionally loading a report template.
Examples
Example 1 - Create a new offscreen report:
C_LONGINT($SR_Err;$newReportArea)
$SR_Err:=SR_NewReport ($newReportArea;"";1)

Example 2 - Create a new offscreen report and load a report from a BLoB field:
C_LONGINT($SR_Err;$newReportArea)
$report:=BLOB to text([Reports]ReportData;UTF8 text without length)
$SR_Err:=SR_NewReport ($newReportArea; $report;1)

SR_NewReportBLOB (ReportRef:L, Src:O) -> error:L


Parameter Type Description
‘‘ ReportRef longint Report reference.
’’ Src text Name of report template (BLoB) to load.
Create a new offscreen report, optionally loading a report template from a BLoB.

59 Commands by Theme
Examples SR_SaveReport - SR_DeleteReport

SR_SaveReport (ReportRef:L; DstPath/XML:T; Options:L) -> error:L

Parameter Type Description


’’ ReportRef longint Report reference.
’’ DstPath/ text The full pathname to a valid SuperReport Pro report
‘‘ XML document, or a valid text variable to receive the XML.
If the parameter is a null string, the standard Save File
dialog will be displayed.
’’ Options longint 0: Dst will be filled with XML
1: Dst is a path, ask if empty

Save the contents of the defined report to a file or as XML in a variable. This command is
equivelant to selecting Save to Disk menu item from the File menu in the SuperReport Pro
report area.
Example 1: Save a report to a field
tReport:=""
iSR_Err:=SR_SaveReport (report_area;tReport;1) // save the report data to a variable
If (iSR_Err=0) //if the command completed successfully
[Customer]customer_report:=tReport
End if

SR_DeleteReport (ReportRef:L) -> error:L

Parameter Type Description


’’ ReportRef longint Report reference.

Delete an offscreen report created with SR_NewReport. You should be sure to always
delete offscreen reports after you've finished with them.
Example
$err:=SR_DeleteReport ($newReportArea)

60 Commands by Theme
ExamplesSR_GetObjectXML - SR_GetProperties

Getters
Use these commands to get information about a report. For a list of properties, see the
Properties section.

SR_GetObjectXML (ReportRef:L, Ref:L, XML:T) -> error:L


Parameter Type Description
’’ ReportRef longint Report reference.
’’ Ref longint 0 for selected objects
1 for report
‘‘ XML text The XML of the specified object.

Get the XML value of the specified object(s) and store it into a text variable.

SR_GetProperties (ReportRef:L; Ref:L; Properties:AT; Values:AT; Names:AT) -> error:L



Parameter Type Description
’’ ReportRef longint Report reference.
’’ Ref longint 0 for selected objects
1 for report
‘‘ Properties text array See SR_SetProperties for a list of properties and their
values.
‘‘ Values text array

‘‘ Names text array (Optional) Array of property names.

Get all properties of object(s) into parallel arrays.

Note: because a text array is used for values, pictures and BLOBs are unusable and real
numbers use decimal point regardless of the current system settings. Also, when operating
on multiple objects (selection), only properties common to all objects are returned and
when there are different values for a property, "<multiple values>" is returned.

This could be used to implement a properties palette.


Example
Get the properties of all objects on the report.
ARRAY TEXT($aPropID;0)
ARRAY TEXT($aPropValue;0)
ARRAY TEXT($aPropName;0)
$err:=SR_GetProperties ($SRArea;1;$aPropID;$aPropValue;$aPropName)

61 Commands by Theme
ExamplesSR_GetPtrProperty - SR_GetLongProperty

SR_GetPtrProperty (ReportRef:L; Ref:L;id:T, Value;P) -> error:L


Parameter Type Description
’’ ReportRef longint Report reference.
’’ Ref longint 0 = selected objects
1 = the report itself
’’ id text

‘‘ Value pointer

Get the value of a property using a pointer. For a list of properties, see the Properties
section.
Example 1 - using a BLoB
C_BLOB($blob)
$error:=SR_GetPtrProperty (vSRArea;1;SRP_Report_UserBLOB;->$blob)

Example 2 - using a pointer


C_POINTER($ptr)
$error:=SR_GetPtrProperty ($area;1; SRP_Area_Self;$ptr)

SR_GetLongProperty (ReportRef:L; Ref:L; id:T) -> Value:L


Parameter Type Description
’’ ReportRef longint Report reference.
’’ Ref longint 0 = selected objects
1 = the report itself
’’ id text

‘‘ Value longint

Get the value of a longint property. For a list of properties, see the Properties section.
Example
Find out which tool in SuperReport Pro's toolbar the user has selected:
$toolId:=SR_GetLongProperty ($SRArea;1;SRP_Area_Tool)

62 Commands by Theme
ExamplesSR_GetObjects - SR_GetRealProperty

SR_GetObjects (ReportRef:L; Ref:L; id:T; Value:AL) -> error:L


Parameter Type Description
’’ ReportRef longint Report reference.
’’ Ref longint Refers to report, section, group or a table object.

’’ id text SRP_ReportAllObjects "objs"


SRP_ReportSelectedObjects "selc"
SRP_ReportEditorStyles "STYL"
SRP_ReportDataSource "DATA"
SRP_ReportGuides "GUID"
SRP_ReportStyleSet "STL#"
SRP_ReportSections "body"
SRP_GroupObjects "objs"
SRP_TableHeaderRowMask "H000" *
SRP_TableColumns "colu"
‘‘ Value longint
array

* Usage is in the "creating report programmatically": use that mask and add the header
row number (starting at 1): String ($row; SRP_TableHeaderRowMask). So for example the
third header line is "H003".

Get the object IDs of a report.


Example
Get the table columns, and then set the style ID for the column header of the first column
to 2:
ARRAY LONGINT($aObjects;0)
$err:=SR_GetObjects ($report;$object;SRP_TableColumns;$aObjects) // get the columns
SR_SetLongProperty ($report;$aObjects{1};SRP_Header_StyleID;2)

SR_GetRealProperty (ReportRef: L;Ref:L; id:T) ->Value:R


Parameter Type Description
’’ ReportRef longint Report reference.
’’ Ref longint 0 = selected objects
1 = the report itself
’’ id text

‘‘ Value real

Get the value of a real property. For a list of properties, see the Properties section.
Example
Get the current DPI setting on the X axis for the repport:
C_REAL($DPI_x)
$DPI_x :=SR_GetRealProperty($report;1; SRP_Area_DPI_X)

63 Commands by Theme
ExamplesSR_GetTextProperty

SR_GetTextProperty (ReportRef:L; Ref:L; id:T) ->Value:T


Parameter Type Description
’’ ReportRef longint Report reference.
’’ Ref longint 0 = selected objects
1 = the report itself
’’ id text

‘‘ Value real

Get one text property of an object. Use ReportRef = 0 and Ref = 0 to access a global plugin
property (such as SRP_Area_Path)
Example
Get the name of the area object (the area's variable name used on the 4D form):
C_TEXT($AreaVariableName)
$AreaVariableName :=SR_GetTextProperty($report;0;0)

64 Commands by Theme
Examples SR_SetPtrProperty - SR_SetLongProperty

Setters

SR_SetPtrProperty (ReportRef:L; Ref:L; id:T; Value:P) -> error:L


Parameter Type Description
’’ ReportRef longint Report reference.
’’ Ref longint 0 = selected objects
1 = the report itself
’’ id text

’’ Value pointer Pointer to a variable containg the value to set.


Set a property of a report using a pointer.

Example
Clear the page setup settings for a report prior to saving it:
C_BLOB($blob)
$err:=SR_SetPtrProperty ($report;1;SRP_Report_PageFormat;->$blob) // Mac
$err:=SR_SetPtrProperty ($report;1;SRP_Report_PrintSettings;->$blob)
$err:=SR_SetPtrProperty ($report;1;SRP_Report_DevMode;->$blob) // Win
$err:=SR_SetPtrProperty ($report;1;SRP_Report_DeviceNames;->$blob)

SR_SetLongProperty (ReportRef:L; Ref:L;id:T; Value:L)


Parameter Type Description
’’ ReportRef longint Report reference.
’’ Ref longint 0 = selected objects
1 = the report itself
’’ id text

’’ Value longint

Set a property of a report using a longint.


Example 1
Hide the SuperReport Pro menu bar:
SR_SetLongProperty ($SR_AREA;1;SRP_Report_ShowMenubar;0)

Example 2
Use PDF for preview, don't embed fonts
SR_SetLongProperty (0; 0; SRP_Area_WinPreviewFlags; SRP_Print_WinPDFPreview | SRP_Print_
WinPDFNoFonts)

Note: SRP_Print_WinOpenPreview is implicit.


Example 3
Use XPS for preview, explicitly open the file after creation - SR_SetAreaLongProperty (0; 0;
SRP_Area_WinPreviewFlags; SRP_Print_WinOpenPreview)

Note: SRP_Print_WinOpenPreview is not implicit.


65 Commands by Theme
ExamplesSR_SetRealProperty - SR_SetTextProperty

Example 4
Create an OXPS preview on Win8 and open after creation.
SR_SetLongProperty (0; 0; SRP_Area_WinPreviewFlags; SRP_Print_WinOpenPreview)
SR_SetTextProperty (0; 0; SRP_Area_WinPreviewName; "MyGreatestAppPreview.oxps")

Note: Windows 7 does not support OXPS!

SR_SetRealProperty (ReportRef:L; inRef:L; id:T; Value:R)


Parameter Type Description
’’ ReportRef longint Report reference.
’’ Ref longint 0 = selected objects
1 = the report itself
’’ id text

’’ Value real

Set a property of a report using a real.


Example
Set the report scale to 200%
SR_SetRealProperty ($report;1;SRP_Report_Scale;2)

SR_SetTextProperty (ReportRef:L; Ref:L; id:T; Value:T)


Parameter Type Description
’’ ReportRef longint Report reference.
’’ Ref longint 0 = selected objects
1 = the report itself
’’ id text

’’ Value text

Set one text property of an object. Use ReportRef = 0 and Ref = 0 to access a global
plugin property (such as SRP_Area_TraceOnError)
Example
Set the report's page margins to 12.5 on all sides:
SR_SetTextProperty ($report;1;SRP_Report_Margins;"12.5;12.5;12.5;12.5")

66 Commands by Theme
ExamplesSR_ChangeObjectParent - SR_DeleteObject

Objects

SR_ChangeObjectParent (ReportRef:L; Ref:L; NewParent:L) -> error:L


Parameter Type Description
’’ ReportRef longint Report reference.
’’ Ref longint 0 = selected objects
1 = the report itself
’’ NewParent longint Reference no. of the new parent object

Move an object from one section/group into another section/group.

SuperReport Pro 3 uses a real object hierarchy - the objects are contained in the section/
group. When you programmatically change position, it will not move to different parent.

An object's position is relative to the parent, so when you change an object's parent, the
relative position will be the same.
Example
$err:=SR_ChangeObjectParent($report;0;$parent)

SR_DeleteObject (ReportRef:L; Ref:L) -> error:L


Parameter Type Description
’’ ReportRef longint Report reference.
’’ Ref longint 0 = selected objects
1 = the report itself

Delete the specified object.


Example
$err:=SR_DeleteObject($report;0)

67 Commands by Theme
ExamplesSR_NewObject - SR_NewObjectFromXML

SR_NewObject (ReportRef:L; Ref:L; id:T; Parent:L) -> error:L


Parameter Type Description
’’ ReportRef longint Report reference.
‘‘ Ref longint 0 = selected objects
1 = the report itself
’’ id text SRP_Group
SRP_Line
SRP_Oval
SRP_Rectangle
SRP_Picture
SRP_Text
SRP_Variable
SRP_Field
SRP_Table
SRP_Header
SRP_BreakHeader
SRP_Body
SRP_BreakFooter
SRP_Footer
SRP_Watermark
SRP_Scrap
SRP_HorizontalGuide
SRP_VerticalGuide
SRP_DataSource
SRP_Style
’’ Parent text For 'normal' objects (not guide, style, section) a parent
must be provided (section or group) in Parent

Create a new object within the given parent.


Example
Create a new header section, then assign a name to it and set its height to 40:
$err:=SR_NewObject ($report;$section;SRP_Header;0)
SR_SetTextProperty ($report;$section;SRP_Header_Name;"Header")
SR_SetLongProperty ($report;$section;SRP_Section_Height;40)

SR_NewObjectFromXML (ReportRef:L; Ref:L; XML:T; Parent:L) -> error:L


Parameter Type Description
’’ ReportRef longint Report reference.
’’ Ref longint 0 = selected objects
1 = the report itself
’’ XML text

’’ Parent text For 'normal' objects (not guide, style, section) a parent
must be provided (section or group) in Parent.

Create a new object from an XML snippet within the given parent. You can create an
object's XML programmatically and then use it to create a new object. It can be any
kind of object except the report itself. The result is the same as creating an object using
SR_NewObject and then setting all the needed properties.

68 Commands by Theme
ExamplesSR_FindObjectByID - SR_GetParent

Example
The creation of styles in the Creating Reports Procedurally example could be rewritten this
way:
$xml:="<Style id=1 name=Headers font=Helvetica size=8 qdStyle=1 wrap=1 lineSpacing=1/>"
$err:=SR_NewObjectFromXML ($rep;$newObjectID;$xml;0) // create style 1
$xml:="<Style id=2 name=Headers font=Helvetica size=8 wrap=1 lineSpacing=1/>"
$err:=SR_NewObjectFromXML ($rep;$newObjectID;$xml;0) // create style 2

NOTE: the above XML is not strictly valid - attributes have to use the syntax attribute="value"
or attribute='value'
SuperReport Pro supports omission of quotes but multi-word values must be quoted.

SR_FindObjectByID (ReportRef:L; Name:T; Ref:L) -> error:L


Parameter Type Description
’’ ReportRef longint Report reference.
’’ Name text

‘‘ Ref longint

Return (in Ref) the first object in a report having SRP_Object_ID equal to Name. The comparison
is strictly equal: it is case- and diacritical-sensitive.
Example
C_LONGINT($ObjectRef)
$err:=SR_FindObjectByID($Report;"Header";$ObjectRef)

SR_GetParent (ReportRef:L; Ref:L; ParentRef:L) -> error:L


Parameter Type Description
’’ ReportRef longint Report reference.
’’ Ref longint 0 = selected objects
1 = the report itself
‘‘ ParentRef longint

Find an object's parent reference.


Example
C_LONGINT($ParentRef)
$err:=SR_GetParent($report;0;$ParentRef)

69 Commands by Theme
ExamplesSR_OpenSession

Printing

SR_OpenSession (Session:L; DstFlags:L; DstPath:T; XML:T; JobName:T; Printer:T) -> error:L


Parameter Type Description
‘‘ Session longint Print session ID.
’’ DstFlags longint Destination flags. See SR_Print Flags for the options.

’’ DstPath text

’’ XML text A template used just for PageSetup/JobSetup.

’’ JobName text

’’ Printer

Start a new printing session. Sessions are a way to print multiple reports as one print job.

Note: on Windows, SRP_Print_DestinationPreview means XPS file creation; on Macintosh, SRP_


Print_DestinationPDF means SRP_Print_DestinationFile.

When printing on Windows using SRP_Print_DestinationPreview, and the option contains SRP_
Print_WinOpenPreview, OPEN WEB URL is used on the destination file ("SRP_Preview.xps"
in User's Documents if no name was provided).
Example
Print reports of your top 20 customers and your top 50 customers as one print job:

$dest:=SRP_Print_AskPageSetup
$err:=SR_OpenSession ($session;$dest;"";[Reports]RM_ReportData;"Top customers";"LaserJet")
QUERY([Reports];[RM_Reports]RM_ReportName="Top 20 Customers")
$err:=SR_Print ([Reports]RM_ReportData;0;0;"";$session)
QUERY([Reports];[Reports]RM_ReportName="Top 50 Customers")
$err:=SR_Print([Reports]RM_ReportData;0;0;"";$session)
$err:=SR_CloseSession ($session)

70 Commands by Theme
ExamplesSR_OpenSessionBLOB - SR_CloseSession

SR_OpenSessionBLOB (Session:L; DstFlags:L; DstPath:T, XML:O; JobName:T; Printer:T) -> error:


Parameter Type Description
‘‘ Session longint Print session ID.
’’ DstFlags longint Destination flags. See SRP_Print Flags for the options.

’’ DstPath text

’’ XML text A template used just for PageSetup/JobSetup.

’’ JobName text

’’ Printer

Start a new printing session and send the result to the BLoB specififed in DstPath. Sessions
are a way to print multiple reports as one print job.

SR_CloseSession (Session:L) -> error:L


Parameter Type Description
’’ Session longint Print session ID.

Close a printing session.


Example
See the example above for SR_OpenSession.

71 Commands by Theme
ExamplesSR_Export

SR_Export (Src:T;Flags:L; DstPath:T; recordDelimiter;L) -> error:L


Parameter Type Description
’’ Src text A valid SuperReport Pro Object. This is not the actual
SuperReport Pro area but rather the report object as
it would be stored in a 4th Dimension BLOB field or
variable.
’’ Flags longint 0 = Ask for file name
1 = It is a file name
Otherwise it is an XML variable.
For other bits, use SuperReport Pro Export Flags:
SRP_Export_Text:256
SRP_Export_PlainText
SRP_Export_CSVFormat:16
SRP_Export_XML:512
SRP_Export_HTML:1024
SRP_Export_Body:4096
SRP_Export_Breaks:8192
SRP_Export_Total:16384
SRP_Export_Headers:32768
SRP_Export_Watermark:65536
SRP_Export_StaticText:32
SRP_Export_Sorted:64

- set exactly one of SRP_Export_Text, SRP_Export_XML,


or SRP_Export_HTML.
- for text export, SRP_Export_CSVFormat can be used
(export 1,2 as "1,2").
- Text can use CSVFormat to escape special characters
- set at least one of SRP_Export_Body, SRP_Export_
Breaks, SRP_Export_Total, SRP_Export_Headers,
SRP_Export_Watermark.
- set SRP_Export_StaticText to export static texts.
- set SRP_Export_Sorted to export in print order, not
visual order (position on page).
’’ DstPath text A valid document pathname. If it is a null string, the
standard Save File dialog will be displayed. If you
want to specify a default value and allow the user to
determine where the file will be saved, pass a value as
the Document Name and use pass a value of one to the
Print Options parameter.
’’ recordDelimiter longint A long integer which can contain 2 characters where the
first character is put in low-order word. The default is
"\r\n" which is equivalent to
Carriage Return | (Line Feed << 16).
The record delimiter is always CR+LF in XML and HTML
modes.
‘‘ error longint See the error numbers listed for SR_Print.

Export SuperReport Pro report without requiring a SuperReport Pro area - the output
written to the specified document is an ASCII interpretation of the report.

NOTE: The Header and Footer sections are only printed once as the report is generated
since the concept of pages don’t existing when writing the report to a document.

72 Commands by Theme
ExamplesSR_ExportBLOBIntoBLOB - SR_ExportIntoBLOB

Examples
Example 1 - Export the Body section of a report to an XML file:
$SR_Err:=SR_Export ($report;SRP_Export_XML;SRP_Export_Body;"Macintosh Disk:ProjectFolder:
Report:MyReport.xml")

Example 2 - Export the Body section of a report to a csv text file:


$SR_Err:=SR_Export ($report; SRP_Export_Text; SRP_Export_CSVFormat;SRP_Export_
Body;"Macintosh Disk:ProjectFolder:Report:MyReport.csv")

SR_ExportBLOBIntoBLOB (Src:O; Flags:L, FieldDelimiter:L; BLOB:O; RecordDelimiter:L)

This is exactly the same as SR_Export, except that both the source and the destination
are BLoBs.

SR_ExportIntoBLOB (Src:T; Flags:L; BLOB:O; recordDelimiter:L) -> error:L

This is exactly the same as SR_Export, except that the destination is a BLoB instead of
a file.
Example
Export a report into a BLoB as HTML.
C_BLOB($Blob)
SET BLOB SIZE($Blob;0)
$flags:=SRP_Export_HTML
SR_ExportIntoBLOB ([Report]ReportData;$flags;$Blob)

73 Commands by Theme
Examples SR_Print

SR_Print (Src:T; Flags:L; DstFlags:L; DstPath:T; Session:L; Printer:T) -> error:L


Parameter Type Description
’’ Src text
’’ Flags longint 0 = Ask for file name
1 = It is a file name
Otherwise it is an XML variable.
’’ DstFlags longint SRP_Print_DestinationPrinter:0
SRP_Print_DestinationFile:1
SRP_Print_DestinationFax:2
SRP_Print_DestinationPreview:3
SRP_Print_DestinationPDF:4
SRP_Print_ValidatePageSetup:16
SRP_Print_DefaultPageSetup:32
SRP_Print_4DPageSetup:64
SRP_Print_SimplePageSetup:128 (use only report
size, orientation and scaling stored in the report, not
platform-native page setup/job setup).
SRP_Print_ValidateJobSetup:256 (note: this option does
nothing).
SRP_Print_DefaultJobSetup:512
SRP_Print_4DJobSetup:102L
SRP_Print_AskPageSetup:4096
SRP_Print_AskJobSetup:8192
SRP_Print_NoProgress:16384
SRP_Print_NoDefaultPrinter:32768 (use printer stored in
the report, if any).
SRP_Print_WinPDFNoFonts:65536
SRP_Print_MacUseDestination:131072
SRP_Print_Default:12288
’’ DstPath text

’’ Session longint If Session is not null, it will be used for printing and
DstFlags/inDstPath/inPrinter will be ignored (and
PageSetup/JobSetup in source will be ignored).

’’ Printer text

‘‘ Error code longint -205: Header/Footer section does not fit on a page.
-206: object does not fit into section/group (probably is
outside the bounds of a fixedheight section/group)
-207: object does not fit into fixed-size group (outside
the bounds of a group)
-210: Header section does not fit on a page
-211: section does not fit on a page
-212: too many sub-pages (horizontal splitting of a
Table object)
-213: too many pages (probably requesting a new page
infinitely)
-214: section does not fit on a new page

Start a new printing session.


Note: on Windows, SRP_Print_DestinationPreview means XPS file creation; on Macintosh, SRP_
Print_DestinationPDF means SRP_Print_DestinationFile.

74 Commands by Theme
ExamplesSR_PrintBLOB

Example
You can use SR_Print to create a PDF directly (on both platforms):
$SR_Err:=SR_Print ($report;0;SRP_Print_DestinationPDF;"Macintosh Disk:ProjectFolder:
Report:MyReport.pdf";0;"")

Or using PDF printer on Windows:


$SR_Err:=SR_Print ($report;0;SRP_Print_DestinationFile;"full path to a file to create";0;"PDF-
XChange 4.0")

SR_PrintBLOB (Src:O; Flags:L, DstFlags:L; DstPath:T; Session:L; Printer:T; ioCount:L) ->error:L


Parameter Type Description
’’ Src text
’’ Flags Not used

’’ DstFlags longint SRP_Print_DestinationPrinter:0


SRP_Print_DestinationFile:1
SRP_Print_DestinationFax:2
SRP_Print_DestinationPreview:3
SRP_Print_DestinationPDF:4
SRP_Print_ValidatePageSetup:16
SRP_Print_DefaultPageSetup:32
SRP_Print_4DPageSetup:64
SRP_Print_SimplePageSetup:128 (use only report
size, orientation and scaling stored in the report, not
platform-native page setup/job setup)
SRP_Print_ValidateJobSetup:256 (note: this option does
nothing)
SRP_Print_DefaultJobSetup:512
SRP_Print_4DJobSetup:102L
SRP_Print_AskPageSetup:4096
SRP_Print_AskJobSetup:8192
SRP_Print_NoProgress:16384
SRP_Print_NoDefaultPrinter:32768 (use printer stored in
the report, if any)
SRP_Print_WinPDFNoFonts:65536
SRP_Print_MacUseDestination:131072
SRP_Print_Default:12288
’’ DstPath text

’’ Session longint If Session is not null, it will be used for printing and
inDstFlags/inDstPath/inPrinter will be ignored (and
PageSetup/JobSetup in source will be ignored).

’’ Printer text

’’ ioCount longint If ioCount is nonzero, the report is not printed; instead,


‘‘ the number of pages is returned in ioCount.

75 Commands by Theme
ExamplesSR_PrintSettings - SR_PrintIntoPICT

SR_PrintSettings (ReportRef:L; Options) -> error:L


Parameter Type Description
’’ ReportRef longint Report reference.
’’ Options A combination of:
SRP_Print_ValidatePageSetup
SRP_Print_DefaultPageSetup
SRP_Print_4DPageSetup
SRP_Print_SimplePageSetup *
SRP_Print_DefaultJobSetup
SRP_Print_4DJobSetup
SRP_Print_AskPageSetup
SRP_Print_AskJobSetup

* Use only the report size, orientation and scaling stored in the report, not platform-native
page setup/job setup.

Set various printing options.


Example
$err:=SR_PrintSettings ($report;SRP_Print_ValidatePageSetup)

SR_PrintIntoPICT (Src:T; Flags:L; DstFlags:L; DstArray:AP; DstFormat:L; Printer:T) -> error:L


Parameter Type Description
’’ Src text A valid SuperReport Pro Object. This is not the actual
SuperReport Pro area but rather the report object as
it would be stored in a 4th Dimension BLOB field or
variable.
If Src="<?xml@", Flags is ignored because Src is XML.
’’ Flags longint 0 = Src is XML
1 = Src is a file name; ask for the file name is Src is
empty.
’’ DstFlags Longint See SRP Print Flags - but the destination is ignored -
only the PageSetup bits are usable.
’’ DSTArray Array The array should be initialised as ARRAY PICTURE; If the
Picture array is not empty, the pictures will be added.
’’ DSTFormat Longint 0 - default - vector graphics (SRP_PrintPict_PDFVector
- PDF on Mac, SRP_PrintPict_EMFVector - EMF on
Windows)
1 - SRP_PrintPict_PNG
2 - SRP_PrintPict_TIFF
3 - SRP_PrintPict_JPEG
4 - SRP_PrintPict_BMP
5 - SRP_PrintPict_GIF
6 - SRP_PrintPict_PDFBitmap (on Mac)

Bitmaps are generated at 72 DPI


’’ Printer text The printer driver to use.

Print the report and save it as a picture.

76 Commands by Theme
ExamplesSR_PrintBLOBIntoPICT

SR_PrintBLOBIntoPICT (Src:O; Flags:L, DstFlags:L; DstArray:AP; DstFormat:L; Printer:T) -> error:L


Parameter Type Description
’’ Src BLoB The BLoB to print.
’’ Flags longint Not used.

’’ DstFlags Longint See SRP Print Flags - but the destination is ignored -
only the PageSetup bits are usable.
’’ DSTArray Array The array should be initialised as ARRAY PICTURE; If the
Picture array is not empty, the pictures will be added.
’’ DSTFormat Longint 0 - default - vector graphics (SRP_PrintPict_PDFVector
- PDF on Mac, SRP_PrintPict_EMFVector - EMF on
Windows)
1 - SRP_PrintPict_PNG
2 - SRP_PrintPict_TIFF
3 - SRP_PrintPict_JPEG
4 - SRP_PrintPict_BMP
5 - SRP_PrintPict_GIF
6 - SRP_PrintPict_PDFBitmap (on Mac)

Bitmaps are generated at 72 DPI.


’’ Printer text The printer driver to use.

Print the specified BLoB into a picture.

77 Commands by Theme
ExamplesSR_ExecuteScript - SR_Area_SaveUndo - SR_Area_AddUndo

Miscellaneous

SR_ExecuteScript (ReportRef:L) -> error:L


Parameter Type Description
’’ ReportRef longint

Set a flag to execute the object script at the next idle event.
Example
$err:=SR_ExecuteScript($report)

SR_Area_SaveUndo (ReportRef:L; Operation:L) -> error:L


Parameter Type Description
’’ ReportRef longint
’’ Operation longint -1 = pause
-2 = resume
0 = stop
anything else: start

SuperReport Pro contains unlimited undo support. The plugin records all user actions and
inserts them into the undo stack. Changes executed to the report through code must be
inserted into the undo stack explicitly with the SR_Area_SaveUndo command.
The Operation parameter is used for naming Undo/Redo menu items. Internally, menu
command IDs are used, e.g. 219 = Group objects.
Example
// start recording actions
$Err:=SR_Area_SaveUndo ($ReportRef;1)
// execute any commands
// ...
// stop recording and save actions to undo stack
$Err:=SR_Area_SaveUndo($ReportRef;0)

SR_Area_AddUndo (ReportRef:L; Ref:L;OldState:L) -> error:L


Parameter Type Description
’’ ReportRef longint
’’ Ref 0 = selected objects
1 = the report itself
’’ OldState 0 means save current state of object Ref as "new state"
for redo; any other value means save it as "old state"
for undo.

This command is for "batch" manipulation - save the old state ("snapshot" - actually
full XML of that object), pause undo recording, modify many properties, resume undo
recording, add a "snapshot" of the new state.

78 Commands by Theme
ExamplesSR_Area_Undo - SR_Area_Redo - SR_ColorPicker

SR_Area_Undo (ReportRef:L) -> error:L


Parameter Type Description
’’ ReportRef longint

Execute the next undo action from the Undo stack.


Example
$Err:=SR_Area_Undo($ReportRef)

SR_Area_Redo (ReportRef:L) -> error:L


Parameter Type Description
’’ ReportRef longint

Execute the next redo action from the Undo stack.


Example
$Err:=RW_Area_Redo($ReportRef)

SR_ColorPicker (Color:L; ActionValue:L) -> ok:L


Parameter Type Description
’’ Color longint The default color to preselect.
’’ ActionValue longint ioActionValue on input:
0 - show platform native color picker
1 - show 4D RGB color picker (supports alpha channel)
2 - don't show a picker

ioActionValue on output: ioColor mixed with white


background.
result is 1 if OK, 0 otherwise (user cancelled).

Invoke the color picker, optionally setting a default color.


Example 1 - Use the native color picker:

$color:=-65536
$err:=SR_ColorPicker($color;0)

Example 2 - Use the 4D form color picker:

$color:=0xFFFF0000 // full red


$err:=SR_ColorPicker($color;1)

79 Commands by Theme
Examples SR_DetokenizeScript - SR_RunScript - SR_RunTokenizedScript

Example 3 - use the 4D form color picker, return the mixed value
$color:=0x80FF0000 // 50% transparent red
$mixed:=1
$err:=SR_ColorPicker($color;$mixed)

Assuming the user didn't change anything and clicked OK, $err=1 and $mixed=0xFF7F0000.

or:
$color:=0x80FF0000 // 50% transparent red
$mixed:=2
$err:=SR_ColorPicker($color;$mixed) // return the mixed value

$err=1 and $mixed=0xFF7F0000


This is used in SuperReport Pro 4D forms to display semi-transparent colors (4D does not
support alpha channel).

SR_DetokenizeScript (BLOB:O) -> text:T


Parameter Type Description
’’ BLoB BLoB Tokenized script in a BLoB.
‘‘ Text Text The detokenized script.

Detokenize a script that was previously tokenized with SR_TokenizeScript.

SR_RunScript (Text:T)
Parameter Type Description
’’ Text text Script to execute.

Execute the script in "Text". The script can contain control structures. If you're familiar
with the Footrunner plugin from Footprints, this command functions in very much the
same way.
Example
Load a saved script from a record and execute it:
$Script:=[Scripts]ScriptData
SR_RunScript ($Script)

SR_RunTokenizedScript (BLOB:O)
Parameter Type Description
’’ BLoB BLoB Tokenized script to execute.

Run a script that was tokenized with SR_TokenizeScript.

80 Commands by Theme
ExamplesSR_TokenizeScript

SR_TokenizeScript (Text:T; BLoB:O) ->length:L


Parameter Type Description
’’ Text text Script to tokenize.
‘‘ BLoB BLoB The tokenized script.
‘‘ length longint Length of the BLoB.

Tokenize the script in "Text" and save it into a BLoB. If you need to create a long or
complex script, you can create it in 4D, tokenize it, and save it. You can then use
DOCUMENT TO BLOB with SR_GetTextProperty (0;0;"patR")+"(name)" and run it
with SR_RunTokenizedScript.

81 Commands by Theme
Properties by Theme

Properties by Theme
In this section you’ll find complete details about each property that can be used with the
SuperReport Pro commands. They are organised into themes according to which group of
commands they relate to:
Area/Plugin/Event Properties
Area Properties
Plugin Properties
Event Properties
Report Properties
Objects
Object Properties
Group Properties
Line Properties
Oval Properties
Rectangle Properties
Picture Properties
Text Properties
Text Style Properties
Variable Properties
Variable Style Properties
Field Properties
Field Style Properties
Table Properties
Header Properties
Header Style Properties
Column Properties
Column Style Properties
Section
Section Properties
Header/Footer Properties
Section Break Properties
Watermark Properties
Guide Properties
Style Properties
Data Source Properties

The following details are included for each property:


Constant: the name of the property that you type into the command.
Get: whether the constant can be used in Getter commands
Set: whether it can be used in Setter commands

83 Properties by Theme
Properties by Theme

Per: Persistent. If a property is persistent, it means that the property is saved with the
area definition and will be applied when the area is displayed again.
Type: the type of the value:
Bool: boolean value (True=1 or False=0)
Longint: a long integer
Real: a real number
Text: an alphanumeric
Color: the “Color” type will accept six methods, whether as string variables or
longint variables. See Working with colors in the User Guide.

Default: the default value that will be used for this property unless you specify otherwise
Min: the minimum acceptable value, where appropriate
Max: the maximum acceptable value, where appropriate
Comments: a description of the constant and, where appropriate, a list of allowable
options

84 Properties by Theme
Area/Plugin/Event Properties

Area/Plugin/Event Properties

Area Properties

Constant Get Set Per Type Default Min Max Comments


SuperReport Pro Area Properties
SRP_Area_ int 0 0 7 Drawing mode of the objects:
DrawingMode 0 - normal
1 - alias
2 - format
3 - name
4 - ID
5 - order
6 - size
7 - value

SRP_Area_ int 0 0 3 Draw sections as of page X


DrawingPage 0 - all
1 - first page
2 - second page
3 - last page
SRP_Area_IsArea bool Is this a SuperReport Pro area?

SRP_Area_Name text Name of the area object (variable


name on 4D form)
SRP_Area_ScrollLeft real Horizontal scroll position

SRP_Area_ScrollTop real Vertical scroll position

SRP_Area_Selected bool Is selected (has focus in 4D)

SRP_Area_Self pointer Pointer to the area object

SRP_Area_Tool int 0 0 8 Current tool:


0 - selection SRP_Tool_Select
1 - text SRP_Tool_Text
2 - field SRP_Tool_Field
3 - variable SRP_Tool_Variable
4 - line SRP_Tool_Line
5 - rectangle SRP_Tool_Rectangle
6 - oval SRP_Tool_Oval
7 - picture SRP_Tool_Picture
8 - table SRP_Tool_Table

SRP_Area_Report int Handle to associated report

SRP_Area_Visible bool Area is visible


Set to false before showing another
dialog over SuperReport Pro to hide
scrollbars

85 Properties by Theme
Area/Plugin/Event Properties

Constant Get Set Per Type Default Min Max Comments


SuperReport Pro Area Properties
SRP_Object_Kind text Object kind = "SuperReport Pro"
RP_ObjectKind_Area "SuperReport
Pro"
SRP_ObjectKind_Report "Report"
SRP_ObjectKind_DataSource
"DataSource"
SRP_ObjectKind_Style "Style"
SRP_ObjectKind_Guide "Guide"
SRP_ObjectKind_Section "Section"
SRP_ObjectKind_Group "Group"
SRP_ObjectKind_Line "Line"
SRP_ObjectKind_Rectangle "Rect"
SRP_ObjectKind_Oval "Oval"
SRP_ObjectKind_Picture "Pict"
SRP_ObjectKind_Text "Text"
SRP_ObjectKind_Variable "Var"
SRP_ObjectKind_Field "Field"
SRP_ObjectKind_Table "Table"
SRP_ObjectKind_Header "Header"
SRP_ObjectKind_Column "Column"

Plugin Properties

Constant Get Set Per Type Default Min Max Comments


SuperReport Pro Plugin Properties
SRP_Area_Copyright text Copyright of the SuperReport Pro
plugin

SRP_Area_Document text Set when a document is loaded or


saved

SRP_Area_DPI_X real Current DPI - X value

SRP_Area_DPI_Y real Current DPI - Y value

SRP_Area_ text html Standard file extension for html


ExtensionHTML export
Setting an empty string resets the
extension to the default
SRP_Area_ text xml Standard file extension for report
ExtensionSRP Old "srp" is always accepted
Setting an empty string resets the
extension to the default
SRP_Area_ text txt Standard file extension for text
ExtensionTXT export
Setting an empty string resets the
extension to the default

SRP_Area_ text xml Standard file extension for xml


ExtensionXML export
Setting an empty string resets the
extension to the default

86 Properties by Theme
Area/Plugin/Event Properties

Constant Get Set Per Type Default Min Max Comments


SuperReport Pro Plugin Properties
SRP_Area_LastError int Last error in ANY SuperReport Pro
command
SRP_Area_Moving real 1 0.1 5 Control moving/resizing objects with
arrow keys
Values are in pixels
It is a global property - example of
usage:
SR_SetRealProperty(0;0;
SRP_Area_Moving;$MoveValue)

SRP_Area_NewReport text Default empty report

SRP_Area_ text Notification callback (e.g. for


NotificationCallback properties palette implementation)
Called as: Handler (ReportRef:L;
CallbackType:L; rebuild:B)
where CallbackType is the same as in
event or editor callbacks
Rebuild is True if the report was
modified since the last call
SRP_Area_Path text Path to the SuperReport Pro plugin

SRP_Area_Proximity real 2.5 0.05 10 Distance from which will be dragged


points snapped to guides or grid
points

SRP_Area_Rounding real 1 0.1 10000 If set to N, all position values are


rounded to 1/N of point
For example, setting it to 100 will
cause all positions be rounded to
1/100 (0.01) pt

SRP_Area_ScrollWheel real 10 1 1000 Multiplier on mouse wheel move


If you use the mouse wheel, the
option key will make the scroll 10x
faster; the control or command key
will make it SRP_Area_ScrollWheel
times faster

SRP_Area_ToolTips int 0 2 Enable tool tips

SRP_Area_ bool yes Invoke the 4D debugger if a


TraceOnError command causes an error, and it is
a command does not return an error
code

SRP_Area_VarArea text SRArea Standard variable name

SRP_Area_ text SRBegHTML Standard variable name


VarBegHTML
SRP_Area_VarDate text SRDate Standard variable name

SRP_Area_ text SRDateTime Standard variable name


VarDateTime
SRP_Area_ text SREndHTML Standard variable name
VarEndHTML
SRP_Area_VarName text SRName Standard variable name

87 Properties by Theme
Area/Plugin/Event Properties

Constant Get Set Per Type Default Min Max Comments


SuperReport Pro Plugin Properties
SRP_Area_VarObject text SRObject Standard variable name

SRP_Area_VarPage text SRPage Standard variable name

SRP_Area_VarPages text SRPages Standard variable name

SRP_Area_VarRecord text SRRecord Standard variable name

SRP_Area_VarTime text SRTime Standard variable name

SRP_Area_Version text Version of the SuperReport Pro


plugin
SRP_Area_ int 0 Additional flags to use when preview
WinPreviewFlags in the editor or 'SR Preview' is used
on Windows
Only 3 bits are used:
SRP_Print_WinOpenPreview,
SRP_Print_WinPDFPreview,
SRP_Print_WinPDFNoFonts

Note: When
SRP_Print_WinOpenPreview is
specified and the "Microsoft XPS
Document Writer" printer is set to
open the file after printing, it will
open twice

See examples of usage with


SR_SetLongProperty

SRP_Area_ text "" Name of a file to use when Preview


WinPreviewName is used on Windows
Preview means
SRP_Print_DestinationPreview is
specified (preview in editor, SR
Preview, SR_Print)

The printer used for preview
is "Microsoft XPS Document
Writer" If it does not exist or
SRP_Print_WinPDFPreview is
specified, the internal PDF creator is
used

If a destination name is not
provided, "SRP_Preview.xps" is used

If the destination name is not a
fully qualified name, the user's
Documents directory is used

The suffix is changed to ".pdf"
if SRP_Print_WinPDFPreview is
specified

The suffix is changed to ".xps" if
SRP_Print_WinPDFPreview is not
specified and the suffix is not ".xps"
or ".oxps"

See examples of usage with


SR_SetLongProperty

88 Properties by Theme
Area/Plugin/Event Properties

Event Properties

Constant Get Set Per Type Default Min Max Comments


SuperReport Pro Events
SRP_Area_ text Editor event callback function
CallbackMethEdit
SRP_Area_ int Last object created by user
CreatedObject
SRP_Area_DoubleClick bool Last click is double click

SRP_Area_Event int Kind of event:


1 - mouse down
3 - key down
5 - auto key
18 - mouse moved
21 - select
22 - deselect
25 - scroll
30 - Undo
31 - Cut
32 - Copy
33 - Paste
34 - Clear
35 - Select all
36 - Redo
39 - mouse wheel
SRP_Area_EventChar text Char (string) from keyboard

SRP_Area_EventKey text Key code

SRP_Area_ int Event modifiers:


EventModifiers 256 - command
512 - shift
1024 - caps lock
2048 - option
4096 - control

SRP_Area_EventPosH int Horizontal mouse position

SRP_Area_EventPosV int Vertical mouse position

SRP_Area_HitObject int Object under mouse

SRP_Area_HitPart int Part of object under mouse:


0 - none
1 - object
2 - top/left
3 - top/center
4 - top/right
5 - right/center
6 - bottom/right
7 - bottom/center
8 - bottom/left
9 - left/center
10 - horizontal resize
11 - vertical resize

89 Properties by Theme
Report Properties

Report Properties

Constant Get Set Per Type Default Min Max Comments


SuperReport Pro Report Properties
SRP_Object_ID text ID used in XML/HTML export

SRP_Object_Kind text Object kind = "Report"

SRP_Object_Name text Name used in XML/HTML export/


print job

SRP_Object_Selected bool Object is selected in the report


(every object except the DataSource
can be selected)

SRP_Object_XML text XML of the object

SRP_Print_ int 0 0 1 On Windows, use PDF instead of XPS


WinPDFPreview for preview

SRP_Report_ bool no Show basic dialog for Database


BasicSRMenu menu->Main Table
SRP_Report_ text Event callback method
CallbackMethEvent
SRP_Report_ int 0 0 1 If set to 1, modify behavior of
CallbackVersion menu event callback and all custom
methods associated with menu items
If set to 1, menu event callback (set
with SRP_Report_CallbackMethEvent
or old 'SR On Event') has to add
C_LONGINT($0)
$0:=0x0001 // set to zero to not
execute the menu item method/
standard action
And any method called as menu item
override (set with SR Menu Item
($area; SR
MenuItem Set 4D Method; $menuID;
"";0;0;"myMenuItemCallback")) has
to add
C_LONGINT($1) // the SRP area
C_LONGINT($2) // menu ID
This is required to function in
compiled mode
This way you can have one method
for all menu item action overrides

SRP_Report_ int 1 1 32 Number of columns in Body section


ColumnCount
SRP_Report_ bool no Column print order is horizontal
ColumnOrder
SRP_Report_ real 5 0 256 Space between the columns
ColumnSpacing
SRP_Report_ bool no Calculate number of pages before
CountPages printing
SRP_Report_ long/int Object ID of the data source
DataSource
SRP_Report_ BLOB Win: device names (binary)
DeviceNames

90 Properties by Theme
Report Properties

Constant Get Set Per Type Default Min Max Comments


SuperReport Pro Report Properties
SRP_Report_DevMode BLOB Win: device mode (binary)

SRP_Report_ text Full path to the document


Document
SRP_Report_DoMenu int Execute specified menu item (or
associated method if specified for
that menu item)
SRP_Report_ int Execute specified menu item
DoMenuNoProc (ignoring associated method if
specified for that menu item)
SRP_Report_ bool yes Enable editing of scripts
EnableScripts
SRP_Report_ int TAB The field delimiter for text export
ExportDelimiter used with File->Export
SRP_Report_ int 0 Flags used with File->Export (last set
ExportFlags by user)
256 - SRP_Export_Text
16 - SRP_Export_CSVFormat
512 - SRP_Export_XML
1024 - SRP_Export_HTML
4096 - SRP_Export_Body
8192 - SRP_Export_Breaks
16384 - SRP_Export_Total
32768 - SRP_Export_Headers
65536 - SRP_Export_Watermark
32 - SRP_Export_StaticText
64 - SRP_Export_Sorted
128 - SRP_Export_PlainText
SRP_Report_ int Record delimiter to be used for text
ExportRecDelimiter export
Record delimiter is a long integer
which can contain 2 characters
where the first character is put in the
low-order word
The default is "\r\n" which is
equivalent to Carriage Return | (Line
Feed << 16)
SRP_Report_GridSize int 12 4 256 Grid siez, in SRP_Report_RulerUnits

SRP_Report_HideHTML bool Hide HTML in UI

SRP_Report_ bool no Lock the guides


LockGuides
SRP_Report_ bool no Lock the sections of the report
LockSections
SRP_Report_ real 0 Bottom margin in points
MarginBottom
SRP_Report_ real 0 Left-hand margin in points
MarginLeft
SRP_Report_Margins text Page margins: left, top, right, bottom
as a string - eg: "1.5;1.5;1.5;1.5"

SRP_Report_ real 0 Right-hand margin in points


MarginRight
SRP_Report_ real 0 Top margin in points
MarginTop

91 Properties by Theme
Report Properties

Constant Get Set Per Type Default Min Max Comments


SuperReport Pro Report Properties
SRP_Report_Modified int Non-zero if modified (it is actually a
counter of changes)
SRP_Report_ BLOB All sections with all objects in the
ObjectHierarchy report as List in BLOB
Use BLoB TO LIST to get the list
object
SRP_Report_ BLOB MacOS: flattened page format (xml)
PageFormat
SRP_Report_ real 100 4096 The page height in points
PageHeight
SRP_Report_ real 100 4096 The page width in points
PageWidth
SRP_Report_ bool no Use physical paper? (printable area
PhysicalPaper otherwise)
SRP_Report_ BLOB MacOS: flattened print settings (xml)
PrintSettings
SRP_Report_ int 1 1 3 1 = point
RulerUnits 2 = mm
3 = inch

SRP_Report_ShowGrid bool no Display the grid

SRP_Report_Scale real 1 0.1 10 View scale

SRP_Report_ bool yes Display the guide lines


ShowGuides
SRP_Report_ bool yes Display the margins
ShowMargins
SRP_Report_ bool yes Display the SuperReport Pro
ShowMenubar menubar
SRP_Report_ bool no Show objects' borders
ShowObjBorders
SRP_Report_ bool no Display the SuperReport Pro ruler
ShowRuler
SRP_Report_ bool yes Show section labels
ShowSections
SRP_Report_ bool yes Show Database menu
ShowSRMenu
SRP_Report_ bool yes Display the SuperReport Pro toolbar
ShowToolbar
SRP_Report_ bool yes Enable Zoom (open report in
ShowZoom external window)
SRP_Report_ bool no Snap objects to the grid
SnapToGrid
SRP_Report_ bool no Snap objects to the guides
SnapToGuides
SRP_Report_UserBLOB BLoB BLoB for free use by developer

SRP_Report_Version real Version of the report format


(currently 1.0)
SRP_Report_ BLOB Virtual commands as list in BLOB
VirtualCommands

92 Properties by Theme
Report Properties

Constant Get Set Per Type Default Min Max Comments


SuperReport Pro Report Properties
SRP_Report_ BLOB Virtual structure as list in BLOB
VirtualStructure
SRP_Report_ BLOB Virtual variables as list in BLOB
VirtualVariables
SRP_Report_ZoomTitle text Name to use when "zooming" area to
external window

93 Properties by Theme
Objects

Objects

Object Properties

Constant Get Set Per Type Default Min Max Comments


SuperReport Pro Object Properties
SRP_Object_Align int 0 0 3 Position in parent
0 - current
1 - left
2 - center
3 - right

SRP_Object_Align is a common
object property: every leaf object
(except table header and table
column) in a section can be
positioned on the left, in the middle
or on the right
This is usable when physical paper is
used (SRP_Report_PhysicalPaper) - it
takes care of margins
Or when printable area is used -
align right will be at the right margin

SRP_Object_ int 0 0 2 Bind to right side of parent:


BindToParentH 0 - none SRP_Object_Bind_None
1 - move SRP_Object_Bind_Move
2 - grow SRP_Object_Bind_Grow
Not applicable to table/column/
header

SRP_Object_ int 0 0 2 Bind to bottom side of parent;


BindToParentV 0 - none SRP_Object_Bind_None
1 - move SRP_Object_Bind_Move
2 - grow SRP_Object_Bind_Grow
Not applicable to table/column/
header

SRP_Object_Draw int 1 0 3 Draw object:


0 - no
1 - yes
2 - on overflow
3 - always

SRP_Object_Export bool yes Should be exported?

SRP_Object_FixH bool no Fixed horizontal position

SRP_Object_FixV bool no Fixed vertical position

SRP_Object_ID text Object ID used in XML/HTML export

SRP_Object_Locked int 0 0 2 0 - unlocked


1 - locked
2 - locked & not selectable

SRP_Object_Name text Object name used in XML/HTML


export
SRP_Object_Order int Print order

94 Properties by Theme
Objects

Constant Get Set Per Type Default Min Max Comments


SuperReport Pro Object Properties
SRP_Object_ real Bottom coordinate of the object
PosBottom position - relative to the parent
SRP_Object_PosHeight real Height of the object position -
relative to the parent
SRP_Object_PosLeft real Left coordinate of the object position
- relative to the parent
SRP_Object_PosRight real Right coordinate of the object
position - relative to the parent
SRP_Object_PosTop real Top coordinate of the object position
- relative to the parent
SRP_Object_PosWidth real Width of the object position - relative
to the parent
SRP_Object_Rect rect Object rectangle as
"left;top;right;bottom"- relative to
the parent
SRP_Object_Selected bool yes Object is selected in the report

SRP_Object_ bool no Can grow/shrink horizontally


VariableSizeH Not appllicable to table/column/
header

SRP_Object_ bool no Can grow/shrink vertically


VariableSizeV Not appllicable to table/column/
header

SRP_Object_Visible bool yes Object is visible (is not hidden)

SRP_Object_RelMoveH real Move horizontally by X points

SRP_Object_RelMoveV real Move vertically by X points

SRP_Object_ real Move bottom side by X points


RelPosBottom
SRP_Object_RelPosLeft real Move left side by X points

SRP_Object_ real Move right side by X points


RelPosRight
SRP_Object_RelPosTop real Move top side by X points

Group Properties

Constant Get Set Per Type Default Min Max Comments


SuperReport Pro Group Properties
SRP_Object_Kind text Object kind = "Group"

SRP_Group_Objects int Number of objects owned by this


group

95 Properties by Theme
Objects

Line Properties

Constant Get Set Per Type Default Min Max Comments


SuperReport Pro Line Properties
SRP_Object_Kind text Object kind = "Line"

SRP_Line_Color color black Line color

SRP_Line_Flags int undefined 0 4 Line kind:


0 - horizontal
1 - vertical
2 - top/left to bottom/right
3 - bottom/left to top/right
4 - full X
SRP_Line_Thickness real 1 0 10 Line thickness in points

Oval Properties

Constant Get Set Per Type Default Min Max Comments


SuperReport Pro Oval Properties
SRP_Oval_Color color black Color of the frame

SRP_Oval_Fill bool no Fill the oval with SRP_Oval_FillColor

SRP_Oval_FillColor color black Color to fill the oval with

SRP_Oval_Frame bool yes Oval has a visible frame

SRP_Object_Kind text Object kind = "Oval"

SRP_Oval_Thickness real 1 0 10 Thickness of the oval's frame, in


points

Rectangle Properties

Constant Get Set Per Type Default Min Max Comments


SuperReport Pro Rectangle Properties
SRP_Object_Kind text Object kind = "Rect"

SRP_Rect_Color color black Color of the frame

SRP_Rect_Columns int 1 1 512 No. of columns in the grid

SRP_Rect_Fill bool no Fill the rectangle with


SRP_Rect_FillColor

96 Properties by Theme
Objects

Constant Get Set Per Type Default Min Max Comments


SuperReport Pro Rectangle Properties
SRP_Rect_Flags int 15 0 15 Which border lines to draw:
bit 0: left
bit 1: top
bit 2: right
bit 3: bottom
bit 4: rounded rect

SRP_Rect_FillColor color black Color to fill the rectangle with

SRP_Rect_Rows int 1 1 512 No. of rows in the grid

SRP_Rect_Thickness real 1 0 10 Width of the border in points

Picture Properties

Constant Get Set Per Type Default Min Max Comments


SuperReport Pro Picture Properties
SRP_Object_Kind text Object kind = "Pict"

SRP_Picture_Fill bool no Fill the white spaces of a picture with


SRP_Picture_FillColor
SRP_Picture_FillColor color black Color with which to fill in the white
spaces of the picture
SRP_Picture_Frame bool no Picture has a visible frame

SRP_Picture_ color black Color of the frame


FrameColor
SRP_Picture_ real 2 0 32 Offset area around the outside of the
FrameOffset picture in points
SRP_Picture_ real 1 0 10 Width of the frame
FrameThickness
SRP_Picture_ text When exporting as HTML, put this
HTMLReplace text into the generated HTML in
place of the actual picture
(Pictures can't be embedded into
HTML; a link is needed)
SRP_Picture_Data BLOB/ The picture
PICT
SRP_Picture_Format int 0 0 4 0 - truncated
1 - centered
2 - scaled to fit
3 - scaled proportionally
4 - scaled proportionally centered
SRP_Picture_Height real Height of the picture in points

SRP_Picture_Size int image size

SRP_Picture_Width real Width of the picture in points

97 Properties by Theme
Objects

Text Properties

Constant Get Set Per Type Default Min Max Comments


SuperReport Pro Text Properties
SRP_Object_Kind text Object kind = "Text"

SRP_Text_Attributed bool no Styled text

SRP_Text_Data text The text

SRP_Text_DrawEmpty int 0 0 2 0 - draw


1 - remove
2 - remove enclosing group

SRP_Text_Dynamic bool no Parse for variable substitution


<%variable%>

SRP_Text_Fill bool no

SRP_Text_Frame bool no Text area has a visible frame

SRP_Text_FrameColor color black Color of the frame

SRP_Text_FrameOffset real 2 0 32 Offset on inside of the frame in


points
For example, if a text area has its
height set to 12, frame is on, and
the frame offset is 2, there will be
only 8 points for the text

SRP_Text_ real 1 0 10 Width of the frame in points


FrameThickness
SRP_Text_HTMLPrefix text Into the generated HTML the
SRP_Text_HTMLPrefix's value is
written, then the actual data, then
SRP_Text_HTMLSuffix text the SRP_Text_HTMLSuffix's value

SRP_Text_ bool no If possible, keep all the text in the


KeepTogether box on the same page
If it does not fit into the available
space, a new page is requested, then
it is printed even if it does not fit on
a page

SRP_Text_ParsedData text Parsed text with substituted


variables
When a View Values was used,
the text/variable/field is processed
as at the time of printing - this
is the result of processing the
SRP_Text_Data (identical if
SRP_Text_Dynamic is false)

SRP_Text_ Text style: strike through


StrikeThrough

98 Properties by Theme
Objects

Text Style Properties

Constant Get Set Per Type Default Min Max Comments


SuperReport Pro Text Style Properties
SRP_Style_BackColor color #00FFFFFF Style: background color

SRP_Style_ real 0 -100 256 Style: baseline shift


BaseLineShift

SRP_Style_Features int 0 Style: defined (overriden) properties

SRP_Style_FontName text Style: font name

SRP_Style_Full int 0 0 15 Style: font style:


SRP_Style_Bold
SRP_Style_Italic
SRP_Style_Underline
SRP_Style_StrikeThroug

SRP_Style_HorAlign int 0 0 5 Style: horizontal alignment:


0 - default
1 - left
2 - center
3 - right
4 - justify
5 - full justify

SRP_Style_ real 1 0.1 100 Style: horizontal scale


HorizontalScale
SRP_Style_ real 1.2 1 10 Style: line spacing
LineSpacing
SRP_Style_Rotation real 0 -360 360 Style: rotation of text

SRP_Style_Size real 4 128 Style: font size

SRP_Style_StyleID int 0 Style: style ID

SRP_Style_TextColor color #FF000000 Style: font color

SRP_Style_VertAlign int 0 0 3 Style: vertical alignment:


0 - default
1 - top
2 - center
3 - bottom

SRP_Style_Wrap bool no Style: wrap long lines

99 Properties by Theme
Objects

Variable Properties

Constant Get Set Per Type Default Min Max Comments


SuperReport Pro Variable Properties
SRP_Object_Kind text Object kind = "Var"

SRP_Variable_Alias text Alias of the variable, as defined by


developer using SR Variables in the
old SuperReport Pro API
This is used only in the editor

SRP_Variable_ bool no Styled text


Attributed For more information, see the Text
Style Tags section

SRP_Variable_ int 0 0 7 What to calculate:


Calculate 0 - none
1 - total
2 - min
3 - avg
4 - max
5 - count
6 - stdvar
7 - stddev

SRP_Variable_ int 0 0 2 0 - draw


DrawEmpty 1 - remove
2 - remove enclosing group

SRP_Variable_Fill bool no

SRP_Variable_Format text Formats as defined in 4D


For pictures use formats as defined
for picture objects

SRP_Variable_Frame bool no The object has a visible frame

SRP_Variable_ color black Color of the frame


FrameColor
SRP_Variable_ real 2 0 32 Inside frame offset in points
FrameOffset
SRP_Variable_ real 1 0 10 Width of the frame
FrameThickness
SRP_Variable_ text Into the generated HTML the
HTMLPrefix SRP_Variable_HTMLPrefix's value is
written, then the actual data, then
SRP_Variable_ text
the SRP_Variable_HTMLSuffix's value
HTMLSuffix

SRP_Variable_Index int -2 -2 -2 - variable


-1 - array {currentIteration}
>=0 is array {index}

SRP_Variable_ bool no Keep the entire contents of the


KeepTogether frame on the same page
SRP_Variable_ text See SRP_Text_ParsedData, but
ParsedData it is the variable's value (no
<%variable%> substitution)

100 Properties by Theme


Objects

Constant Get Set Per Type Default Min Max Comments


SuperReport Pro Variable Properties
SRP_Variable_Record text name of a variable to store the
calculated value

SRP_Variable_Repeat int 0 0 2 Repeat this object:


0 - none
1 - horizontal
2 - vertical

SRP_Variable_ real 0 0 128 Offset (distance between) repeating


RepeatOffset objects in points

SRP_Variable_Script text Script to execute when this variable


is printed

SRP_Variable_ BLOB Tokenized version of the script


ScriptTokens (SRP_Variable_Script)
When you open an English report
with a French 4D, for example, you
will see, and SuperReport Pro will
use, the correct French command
names

SRP_Variable_Source text Variable to display

SRP_Variable_UseOld bool yes In break footer/total, use old value


(before the break)

Variable Style Properties

Constant Get Set Per Type Default Min Max Comments


SuperReport Pro Variable Style Properties
SRP_Style_BackColor color #00FFFFFF Style: background color

SRP_Style_ real 0 -100 256 Style: base line shift


BaseLineShift
SRP_Style_Features int 0 Style: defined (overriden) properties

SRP_Style_FontName text Style: font name

SRP_Style_Full int 0 0 7 Style: font style:


SRP_Style_Bold
SRP_Style_Italic
SRP_Style_Underline
SRP_Variable_StrikeThrough

SRP_Style_HorAlign int 0 0 5 Style: horizontal alignment:


0 - default
1 - left
2 - center
3 - right
4 - justify
5 - full justify"

SRP_Style_ real 1 0.1 100 Style: horizontal scale


HorizontalScale

101 Properties by Theme


Objects

Constant Get Set Per Type Default Min Max Comments


SuperReport Pro Variable Style Properties
SRP_Style_ real 1.2 1 10 Style: line spacing
LineSpacing
SRP_Style_Rotation real 0 -360 360 Style: rotation of text

SRP_Style_Size real 4 128 Style: font size

SRP_Style_StyleID int 0 Style: style ID

SRP_Style_TextColor color #FF000000 Style: font color

SRP_Style_VertAlign int 0 0 3 Style: vertical alignment:


0 - default
1 - top
2 - center
3 - bottom

SRP_Style_Wrap bool no Style: wrap long lines

Field Properties

Constant Get Set Per Type Default Min Max Comments


SuperReport Pro Field Properties
SRP_Field_Alias text Alias of the field, as defined by
developer using SR Variables in
the old SuperReport Pro API
This is used only in the editor

SRP_Field_Attributed bool no Multistyled text

SRP_Field_Calculate int 0 0 7 What to calculate:


0 - none
1 - total
2 - min
3 - avg
4 - max
5 - count
6 - stdvar
7 - stddev

SRP_Field_DrawEmpty int 0 0 2 0 - draw


1 - remove
2 - remove enclosing group

SRP_Variable_Fill bool no

SRP_Field_Format text Formats as defined in 4D


For pictures use formats as defined
for picture objects

SRP_Field_Frame bool no Object has a visible frame

SRP_Field_FrameColor color Color of the frame

102 Properties by Theme


Objects

Constant Get Set Per Type Default Min Max Comments


SuperReport Pro Field Properties
SRP_Field_ real 2 0 32 Inside frame offset in points
FrameOffset
SRP_Field_ real 1 0 10 Width of frame in points
FrameThickness
SRP_Field_HTMLPrefix text

SRP_Field_HTMLSuffix text

SRP_Field_ bool no Keep all contents together on the


KeepTogether same page
SRP_Field_ParsedData text See SRP_Text_ParsedData, but it is
the field's value
SRP_Field_Record text Name of a variable to store the
calculated value
SRP_Field_Repeat int 0 0 2 Repeat this object:
0 - none
1 - horizontal
2 - vertical"

SRP_Field_ real 0 0 128 Offset (distance between) repeting


RepeatOffset objects in points
SRP_Field_Script text Script to execute when the field is
printed
SRP_Field_Source text The table and field

SRP_Field_UseOld bool yes In break footer/total, use old value


(before the break)
SRP_Field_ BLOB
ScriptTokens
SRP_Object_Kind text Object kind = "Field"

Field Style Properties

Constant Get Set Per Type Default Min Max Comments


SuperReport Pro Field Style Properties
SRP_Style_BackColor color #00FFFFFF Style: background color

SRP_Style_ real 0 -100 256 Style: base line shift


BaseLineShift
SRP_Style_Features int 0 Style: defined (overridden)
properties
SRP_Style_FontName text Style: font name

SRP_Style_Full int 0 0 7 Style: font style:


SRP_Style_Bold
SRP_Style_Italic
SRP_Style_Underline
SRP_Field_StrikeThrough

103 Properties by Theme


Objects

Constant Get Set Per Type Default Min Max Comments


SuperReport Pro Field Style Properties
SRP_Style_HorAlign int 0 0 5 Style: horizontal alignment:
0 - default
1 - left
2 - center
3 - right
4 - justify
5 - full justify

SRP_Style_ real 1 0.1 100 Style: horizontal scale


HorizontalScale
SRP_Style_ real 1.2 1 10 Style: line spacing
LineSpacing
SRP_Style_Rotation real 0 -360 360 Style: rotation of text

SRP_Style_Size real 4 128 Style: font size

SRP_Style_StyleID int 0 Style: style ID

SRP_Style_TextColor color #FF000000 Style: font color

SRP_Style_VertAlign int 0 0 3 Style: vertical alignment:


0 - default
1 - top
2 - center
3 - bottom
SRP_Style_Wrap bool no Style: wrap long lines

104 Properties by Theme


Table

Table

Table Properties

Constant Get Set Per Type Default Min Max Comments


SuperReport Pro Table Properties
SRP_Object_Kind text Object kind = "Table"

SRP_Table_ int 0 = no
DrawColumns 1 = yes
2 = draw nothing (no headers) if
there are no data

SRP_Table_ bool Print the table headers


DrawHeaders

SRP_Table_Frame int 1 0 2 0 = no frame


1 = single frame
2 = double frame

SRP_Table_FrameColor color Color of the object's frame

SRP_Table_ real 2 0 32 Offset, in points


FrameOffset
SRP_Table_ real 1 0 10 0 = none
FrameThickness 1 = single
2 = double
SRP_Table_ real 1 0 10 Width of gridlines in points
GridThickness
SRP_Table_HTMLPrefix text

SRP_Table_HTMLSuffix text

SRP_Table_ int No. of columns in the table


NumColumns
SRP_Table_ int Number of header rows
NumHeadings
SRP_Table_RowHeight real 0 400 Height of rows
0 = calculate from the style used

SRP_Table_Script text Script to execute when the table is


printed
SRP_Table_ BLOB
ScriptTokens
SRP_Table_StyleID int 0 Style: style ID

SRP_Table_ bool yes Rows can have variable height;


VariableRowHeight SRP_Table_RowHeight is used as
minimum row height

105 Properties by Theme


Table

Header Properties

Constant Get Set Per Type Default Min Max Comments


SuperReport Pro Header Properties
SRP_Header_ bool no Multi-style
Attributed
SRP_Header_ColSpan int 1 0 100 Number of columns to span over

SRP_Header_Data text The header text

SRP_Header_Dynamic bool no Parse for variable substitution


<%variable%> - the variable
substitution is done on first data row
SRP_Header_Fill bool no

SRP_Header_Height real Height of the cell; 0 = automatic

SRP_Header_RowSpan int 1 0 100 Number of header rows to span over

SRP_Header_Width real Width of the cell; 0 = automatic

SRP_Object_Kind text Object kind = "Header"

Header Style Properties

Constant Get Set Per Type Default Min Max Comments


SuperReport Pro Header Style Properties
SRP_Style_BackColor color #00FFFFFF Style: background color

SRP_Style_ real 0 -100 256 Style: baseline shift


BaseLineShift
SRP_Style_Bold bool no Style: font style - bold

SRP_Style_Features int 0 Style: defined (overriden) properties

SRP_Style_FontName text Style: font name

SRP_Style_Full int 0 0 7 Style: font style:


SRP_Style_Bold
SRP_Style_Italic
SRP_Style_Underline
SRP_Header_StrikeThrough

SRP_Style_HorAlign int 0 0 5 Style: horizontal alignment:


0 - default
1 - left
2 - center
3 - right
4 - justify
5 - full justify

SRP_Style_ real 1 0.1 100 Style: horizontal scale


HorizontalScale

106 Properties by Theme


Table

Constant Get Set Per Type Default Min Max Comments


SuperReport Pro Header Style Properties
SRP_Style_Italic bool no Style: font style - italic

SRP_Style_ real 1.2 1 10 Style: line spacing


LineSpacing
SRP_Style_Rotation real 0 -360 360 Style: rotation of text

SRP_Style_Size real 4 128 Style: font size

SRP_Style_StyleID int 0 Style: style ID

SRP_Style_TextColor color #FF000000 Style: font color

SRP_Style_Underline bool no Style: font style - underline

SRP_Style_VertAlign int 0 0 3 Style: vertical alignment:


0 - default
1 - top
2 - center
3 - bottom

SRP_Style_Wrap bool no Style: wrap long lines

107 Properties by Theme


Table

Column Properties

Constant Get Set Per Type Default Min Max Comments


SuperReport Pro Column Properties
SRP_Column_Alias text Alias of the column, as defined by
developer using SR Variables in the
old SuperReport Pro API
This is used only in the editor

SRP_Column_ bool no Multi-style


Attributed
SRP_Column_ bool no Calculate row height on this column
CalcRowHeight
SRP_Column_Fill bool no

SRP_Column_ bool yes Print repeated values


Duplicates
SRP_Column_ int 0 0 Defines the order of execution of the
ExecutionLevel scripts for columns
This enables you to have 1->M->M
related data

SRP_Column_Format text

SRP_Column_Grid bool yes Draw vertical grid for this column

SRP_Column_RowNum bool no Print row number - set when


SRP_Column_Source is set to
"%ROWNUM%"

SRP_Column_Script text Script to execute the the column is


printed
SRP_Column_ BLOB
ScriptTokens
SRP_Column_Source text Source of the data: variable name or
[Table]Field
SRP_Column_Width real Width of the data column; 0 =
automatic
SRP_Object_Kind text Object kind = "Column"

108 Properties by Theme


Table

Column Style Properties

Constant Get Set Per Type Default Min Max Comments


SuperReport Pro Column Style Properties
SRP_Style_BackColor color #00FFFFFF Style: background color

SRP_Style_ real 0 -100 256 Style: baseline shift


BaseLineShift
SRP_Style_Features int 0 Style: defined (overridden)
properties
SRP_Style_FontName text Style: font name

SRP_Style_Full int 0 0 7 Style: font style:


SRP_Style_Bold
SRP_Style_Italic
SRP_Style_Underline
SRP_Column_StrikeThrough

SRP_Style_HorAlign int 0 0 5 Style: horizontal alignment:


0 - default
1 - left
2 - center
3 - right
4 - justify
5 - full justify
SRP_Style_ real 1 0.1 100 Style: horizontal scale
HorizontalScale
SRP_Style_ real 1.2 1 10 Style: line spacing
LineSpacing
SRP_Style_Rotation real 0 -360 360 Style: rotation of text

SRP_Style_Size real 4 128 Style: font size

SRP_Style_StyleID int 0 Style: style ID

SRP_Style_TextColor color #FF000000 Style: font color

SRP_Style_VertAlign int 0 0 3 Style: vertical alignment:


0 - default
1 - top
2 - center
3 - bottom

SRP_Style_Wrap bool no Style: wrap long lines

109 Properties by Theme


Section

Section

Section Properties

Constant Get Set Per Type Default Min Max Comments


SuperReport Pro Section Properties
SRP_Object_Kind text Object kind = "Section":
SRP_SectionKind_Header "Header"
SRP_SectionKind_BreakHeader
"BreakHeader"
SRP_SectionKind_Body "Body"
SRP_SectionKind_BreakFooter
"BreakFooter"
SRP_SectionKind_Footer "Footer"
SRP_SectionKind_Watermark
"Watermark"
SRP_Object_XML Full description of the object - to get/
set the object
E.g. use:
$xml:=SR_GetTextProperty
($report;$object;SRP_Object_XML)
$err:=SR_GetParent
($report;$object;$parent)
$err:=SR_NewObjectFromXML
($report;$object;$xml;$parent)
to create exact duplicate (identical
object at the same location)

SRP_Section_Draw bool yes Used when printing the report 0


means this section will not be printed
All scripts will be executed, but the
printing will not occur
SRP_Section_Export bool yes Export the section

SRP_Section_ bool no The section will not grow/shrink if


FixedHeight set to true; Footer always has fixed
height

SRP_Section_Height real 0 0 4096 Height of the section

SRP_Section_ text
HTMLPrefix

SRP_Section_ text
HTMLSuffix

SRP_Section_ID text ID number of the section

SRP_Section_ bool no
KeepTogether
SRP_Section_Locked int 0 0 2 Section is locked

SRP_Section_ real 0 0 512 Minimum available space on page; if


MinSpace less is available, start a new page
SRP_Section_Name text Section name

SRP_Section_Order int Section print order

110 Properties by Theme


Section

Constant Get Set Per Type Default Min Max Comments


SuperReport Pro Section Properties
SRP_Section_ int 0 0 2 Throw a new page:
PageThrow 0 = none
1 = before the section is printed
2 = after the section is printed

SRP_Section_Script text Script to execute when the section is


printed
SRP_Section_ BLOB
ScriptTokens
SRP_Section_Selected bool Is the section selected?

SRP_Section_Type text Header


BreakHeader
Body
BreakFooter
Footer
Watermark

SRP_Section_Visible bool yes Section is visible

Header/Footer Properties

Constant Get Set Per Type Default Min Max Comments


SuperReport Pro Header/Footer Properties
SRP_Section_FirstPage bool yes Print on first page

SRP_Section_LastPage bool yes Print on last page

SRP_Section_ bool yes Print on subsequent pages except


SecondPage the last page

Note: You can have 3 separate headers/footers, each specifying only one of the three
options - then you have separate first page header, last page header, header printed on
other pages.

111 Properties by Theme


Section

Section Break Properties

Constant Get Set Per Type Default Min Max Comments


SuperReport Pro Section Break Properties
SRP_Section_Break_ text Alias of the section break, as defined
Alias by developer using SR Variables in
the old SuperReport Pro API
This is used only in the editor

SRP_Section_Break_ bool no Always draw on new page


Always
SRP_Section_Break_ int 0 0 Section break level
Level 0 = total

SRP_Section_Break_ text The variable/field to check for value


On change
SRP_Section_Break_ text These are "2 in 1" - when set,
OnArray SRP_Section_Break_Type is set and
the SRP_Section_Break_On is set to
SRP_Section_Break_ text the provided source (variable name
OnField or [Table]Field)
SRP_Section_Break_ text When a getter is used, only
OnVariable the "correct" one (according to
SRP_Section_Break_Type) returns
SRP_Section_Break_On
SRP_Section_Break_On - the
variable/field to check for value
change

SRP_Section_Break_ int 0 1 3 The type of break:


Type 0 = none
1 = field
2 = variable
3 = array {currentIteration}

SRP_Section_ bool no Print the section from bottom of


FooterFromBottom page, not below the body
This is a property of break footer and
footer, where it defaults to true for
footer (footer at the bottom of page)
and false for break footer (break
after the body/higher-level breaks,
not above the footer)

112 Properties by Theme


Guide Properties

Watermark Properties

Constant Get Set Per Type Default Min Max Comments


SuperReport Pro Watermark Properties
SRP_Section_FirstPage bool yes Print the watermark on the first page

SRP_Section_LastPage bool yes Print the watermark on the last page

SRP_Section_ bool yes Print the watermark on the second


SecondPage page
SRP_Section_ bool no Print on top of all other drawings
Watermark_OnTop NOTE: when this property is 0, the
objects in the watermark section are
not selectable with the mouse

Guide Properties

Constant Get Set Per Type Default Min Max Comments


SuperReport Pro Guide Properties
SRP_Guide_Position real Location of the guide

SRP_Guide_Type bool 0 = horizontal


1 = vertical
SRP_Object_Kind text Object kind = "Guide"

113 Properties by Theme


Style Properties

Style Properties

Constant Get Set Per Type Default Min Max Comments


SuperReport Pro Style Properties
SRP_Object_Kind text Object kind = "Style"

SRP_Style_BackColor color #00FFFFFF Style: background color

SRP_Style_ real 0 -100 256 Style: baseline shift


BaseLineShift

SRP_Style_Bold bool no Style: font style - bold

SRP_Style_FontName text Style: font name

SRP_Style_FrameColor color #00FFFFFF Style: frame color

SRP_Style_Full int 0 0 7 Style: font style

SRP_Style_HorAlign int 0 0 5 Style: horizontal alignment:


0 - default
1 - left
2 - center
3 - right
4 - justify
5 - full justify
SRP_Style_ real 1 0.1 100 Style: horizontal scale
HorizontalScale

SRP_Style_ID int 0 Style: style ID

SRP_Style_Italic bool no Style: font style - italic

SRP_Style_ real 1.2 1 10 Style: line spacing


LineSpacing

SRP_Style_Name text

SRP_Style_Rotation real 0 -360 360 Style: rotation of text

SRP_Style_Size real 4 128 Style: font size

SRP_Style_TextColor color #FF000000 Style: font color

SRP_Style_Underline bool no Style: font style - underline

SRP_Style_VertAlign int 0 0 3 Style: vertical alignment:


0 - default
1 - top
2 - center
3 - bottom
SRP_Style_Wrap bool no Style: wrap long lines

114 Properties by Theme


Data Source Properties

Data Source Properties

Constant Get Set Per Type Default Min Max Comments


SuperReport Pro Data Source Properties
SRP_DataSource_Alias text Alias of the data source, as defined
by developer using SR Variables in
the old SuperReport Pro API
This is used only in the editor
SRP_DataSource_ text Script to be executed when a new
BodyScript row is fetched (going to the next
iteration)
This differs from Body's script, which
is executed just before processing
the section (as all sections are
handled the same)
"Processing", because it does not
mean this section will be printed now
- e.g. if there is not enough space,
so footer will be processed, then
header, break headers ...

SRP_DataSource_ BLOB Tokenized version of the script


BodyScriptToks (SRP_DataSource_BodyScript)

SRP_DataSource_ text Callback for scripts execution


Callback

SRP_DataSource_ text Script to be executed after the report


EndScript is finished - to do some cleanup (e.g.
clearing arrays created in the Start
script for the report)

SRP_DataSource_ int 1 1
Iterations

SRP_DataSource_ int 2 0 2 What to do when


RelateMany SRP_DataSource_Source is 1 and
SRP_DataSource_ int 2 0 2 fetching a record:
RelateOne 0 = relations are ignored
1 = use automatic relations
2 = use automatic relations
& do a manual RELATE ONE/
RELATE MANY on the main table
(SRP_DataSource_TableID)

115 Properties by Theme


Data Source Properties

Constant Get Set Per Type Default Min Max Comments


SuperReport Pro Data Source Properties
SRP_DataSource_ text 0 1 4 What defines the number of
Source iterations:
1 = records in selection of
table (table number is in
SRP_DataSource_TableID)
2 = fixed number specified by
SRP_DataSource_Iterations
3 = value of variable (variable name
is in SRP_DataSource_VarName)
4 = size of array (array name is in
SRP_DataSource_VarName)
(These are the old constants in SR
Pro Editor Codes, namely:
SR Iterations Main Table:1:L
SR Iterations Fixed:2:L
SR Iterations Variable:3:L
SR Iterations Array:4:L

SRP_DataSource_ text Script to be executed before the


StartScript report is processed
Even before the number of iterations
is checked (selection/array size/
variable) - so you can create a
selection for the report here

SRP_DataSource_ BLOB Tokenized version of the script


StartScriptToks (SRP_DataSource_StartScript)

SRP_DataSource_ int 0 4D table number


TableID

SRP_DataSource_Type text 4D 4D 4D For future enhancements, currently


must be "4D"

SRP_DataSource_ text Variable name


VarName

SRP_Object_Kind text Object kind = "DataSource"

SRP_Object_XML

116 Properties by Theme


Appendix 1: Troubleshooting

Appendixes

Appendix 1: Troubleshooting

Localised Formats
When the database is set to use ',' and '.' as placeholders, you must not use localized
formats (in other words always use "###,##0.00"), otherwise you must use localized
formats - e.g. "### ##0,00" on some European systems.

118
Appendix 2: Frequently Asked Questions

Appendix 2: Frequently Asked Questions

Q. Can I use SuperReport Pro in the User Environment?


A. Yes, SuperReport Pro can be used on any valid input form, either in the User
Environment or a custom method which calls MODIFY SELECTION.

Q. Can I use the Repeating Objects feature for multi-level relationships? For example, if
I have a Customer, Invoice, and Line Item table, can I use repeating objects to show
all the related Invoices, and show their related Line Items?
A. No, the Repeating Objects feature is designed to work with a single related many
table. In order to create this type of report, you are going to have to create it based
on the Line Item’s table, and using Subheader data, you can show the related one
and its associated related on information. You can use a table object which supports
1->M->M->M->M relations.

Q. Does SuperReport Pro support 64-bit Windows systems?


A. Yes!

Q. Does SuperReport Pro support Macintosh PowerPC systems?


A. The shipping plugin doesn't. However, we can provide a compatible version if needed
- please contact us through www.e-node.net.

Q. Why does the Debugger window sometimes open when I'm executing a SuperReport
Pro script?
A. If an error is encountered whilst a SuperReport Pro script is executing, and
SRP_Area_TraceOnError has been set to True, the 4D debugger window will open. To
turn Trace on error on:
SR_SetLongProperty ($SR_AREA;1;SRP_Area_TraceOnError;1)

To turn it off:
SR_SetLongProperty ($SR_AREA;1;SRP_Area_TraceOnError;0)

Note: This is only relevant for commands that do not return an error code.

Q. Does SuperReport Pro support drag and drop?


A. No.

119
Appendix 2: Frequently Asked Questions

Q. Is there any option to control the size of printed reports when using the PDF destination
for output on Windows?
A. The only option is to not embed fonts (SRP_Print_WinPDFNoFonts).
Text: all used fonts are embedded
E.g. using 2 fonts (Arial and Times New Roman) in a small 2-page report:
- 254 KB without the fonts (still too much - re-saving it using some PDF software produces
93 KB)
- 2.4 MB with the fonts (re-saving it using some PDF software produces 2.3 MB)
Images: Graphics are not down-scaled (e.g. printing 1200 dpi picture is included as-is - it
is not down-scaled to 300 or 600 dpi)
Suggestion: use PDFCreator!
SuperReportPro now supports PDFCreator directly ("print to file" using PDFCreator produces
a PS file; after creation SuperReportPro calls PDFCreator to convert it to a PDF file).
Here is an example of printing to a PDF using PDFCreator:

$err:=SR SetPrinter ("PDFCreator")


$err:=SR SetDestination (SR PrintDestination File;$path)
$err:=SR Print Report ($oReport;0;-1)

Q. Is there a way to set the name of the report when doing a preview?
A. The default job name is the report name - SRP_Report_Name (Edit -> Report Options
--> Name).
If it is empty, "SuperReport Pro" is used.
If you want to change the name of the Preview file on Windows, change
SRP_Area_WinPreviewName; the default is "SRP_Preview.xps" in the user's Documents
directory.

Q. Does SuperReport Pro use a virtual structure, if it has been defined, to look up 4D
fields?
A. Yes. If a virtual structure is in effect and a field is not defined in the virtual structure,
the physical field name is used.

Q. Is there a limit to the undo buffer?


A. yes - it is 65536, which is virtually unlimited.

Q. Can I add a watermark to my report?


A. Yes, you can add a Watermark section (see the User Guide for information about
adding a Watermark Section, and the Watermarks properties section for information
about procedurally controlling watermarks).

120
Appendix 2: Frequently Asked Questions

Q. Which header and footer will be printed if the report has only one page?
A. This depends on the SRP_Section_FirstPage, SRP_Section_SecondPage and
SRP_Section_LastPage properties:
• The first header/footer having both SRP_Section_FirstPage and
SRP_Section_LastPage set to 1
• The first header/footer having one of SRP_Section_FirstPage and
SRP_Section_LastPage set to 1 and SRP_Section_SecondPage set to 0
When multiple pages are to be printed, the behavior is as follows:
• For the first page, the first header/footer having SRP_Section_FirstPage set to 1
• For the last page, the first header/footer having SRP_Section_LastPage set to 1
• For other pages, the first header/footer having SRP_Section_SecondPage set to
1

Q. If I am using SuperReport Pro in a 4D component, which 4D variables are used?


A. All variables are created/accessed in the current scope - so if you are using SuperReport
Pro in a component, it will access the component's variables.

Q. Is it possible to replace one of the menu items with my own code?


A. Yes - use SR Menu Item
NOTE: parameters text, enable, mark and overrideMethod are input (depending on action)
and output (always).
For example, to associate a method with File -> Export:
$err:=SR Menu Item ($area; SR MenuItem Set 4D Method; SR MenuItem Print To Disk; ""; 0; 0;
"methodNameToCall")

For new menu items (w/o a new constant), consult the SRProMenus.xml in the bundle.
When the property SRP_Area_CallbackVersion is set to 1:
• The menu event callback will expect a return value when called with
SR Menu Item Selected Before
• --> add C_LONGINT ($0) and set it to 1 if SuperReport Pro should handle the
menu item
• The menu item callback will be provided with 2 arguments: area and menu ID
• --> add C_LONGINT ($1; $2)

121
Appendix 2: Frequently Asked Questions

Q. Is it possible to intercept SuperReport Pro menu calls via a callback method and
let or not SuperReport Pro execute the appropriate command depending on the
programmer's choice ($0 of the callback method)?
A. No.
• The user chooses a menu item
• If a menu event callback is defined, it is called with SR Menu Item Selected Before
and menu ID
• If a command is set for the menu item, it is executed, otherwise the standard
action is taken
• If a menu event callback is defined, it is called with SR Menu Item Selected After
and the menu ID
To disable standard execution, make the respective menu item disabled...
NOTE: the menu item method gets no parameters (for compatibility), but to provide it
with areaID and menuID is possible (can be made optional - call with arguments or not).

122
Appendix 3: Hints and Tips

Appendix 3: Hints and Tips

Quotes and Double Quotes


When writing XML code, SuperReport Pro supports the use of single quotes instead of
double quotes. For example you can use font='Times New Roman' - you don't have to add
lots of '+Char(Double Quote)' to your code.

Printing
Due the large number of print drivers available, configuring reports for most printers can
be a very difficult task. Following is a list of some tips which can make designing your
reports a manageable job.
1. Try to leave at least 1/4” margin on the edges of your reports to account for a
wide variety of print drivers
2. Stick with common fonts.
3. Be careful of using enhanced font formatting attributes such as Bold, Italic,
Underline, etc. While most print drivers can handle multiple styles for a single
object, some print drivers have problems dealing with multiple styles.
4. Test, test, test! Try to test your reports on as many different printers as possible…
you would be surprised at the differences between drivers.

Section Markers
If you hold down the Shift key while moving a SuperReport Pro section marker, all section
markers under the selected marker will move accordingly.
SuperReport Pro 2 used only "lines" to define the start of a new section (similar to 4D form
editor).
SuperReport Pro 3 always moves all sections, because the sections are containers of
objects and one of them is being resized - all other (not selected) sections are moved.
When moving a section label, hold down the Option key to move only the label horizontally
(not to resize the section); hold down the Shift key to resize the section (not to move the
label horizontally).

Windows Preview
If a printer named "Microsoft XPS Document Writer" does not exist, Preview will not work.
You can check PRINTER LIST to find out it is present and then either install it or disable
Preview.
On Win XP SP3 "Microsoft XPS Document Writer" is present, but instead of XPS Viewer
Internet Explorer is used.

123
Index

Index
Symbols F
4D Server.............................................. 20 Field Properties..................................... 102
%SuperReport........................................ 56 Field Style Properties............................. 103
.xps...................................................... 88 filters.................................................... 13
fonts..................................................... 13
A footers................................................... 12
Adjust Object Size by Style....................... 12 functions................................................ 30
ALP_Area_SRPTableTemplate.................... 47
G
AL_Register............................................ 12
AL_SuperReport................................ 47, 48 Getters.................................................. 60
API.......................................................... 9 Getters and Setters................................. 31
appearance.............................................. 9 Group object.......................................... 12
AreaList Pro............................................ 47 Group Properties..................................... 95
Area Properties....................................... 85 Guide Properties................................... 113

B H
Boolean properties.................................. 10 Header/Footer Properties....................... 111
Boolean values....................................... 29 Header Properties................................. 105
Break Properties................................... 112 headers................................................. 12
Header Style Properties.......................... 106
C HTML export........................................... 41
Column Properties................................. 108 HTML Reports......................................... 39
Column Style Properties......................... 109
I
Compatibility............................................ 8
Compatibility Mode.................................... 9 internal variables.................................... 15
Count Pages........................................... 12
L
D
Licence, registering................................. 16
Data Source Properties................... 114, 115 License types.......................................... 22
Debugger........................................ 31, 119 Line Properties........................................ 96
Double Quotes...................................... 123 Localised Formats................................. 118
Dynamic Text.......................................... 12 local variables......................................... 13

E M
Event Cycle............................................ 36 Merged.................................................. 20
Event Properties...................................... 89 Multi-style (attributed) text...................... 13
Events (constants).................................. 89
Export to HTML....................................... 39
N
Native drawing of Text............................. 13

O
Object Properties.................................... 94
Objects............................................ 67, 94
Object Scripts......................................... 34
On Load................................................. 30

125
Index

OPEN WEB URL....................................... 70 SR_Export............................. 29, 41, 72, 76


Output As HTML File................................ 41 SR_ExportBLOBIntoBLOB......................... 73
Oval Properties....................................... 96 SR_ExportIntoBLOB........................... 42, 73
SR File Types.......................................... 11
P SR_FindObjectByID................................. 69
Parameter Descriptions............................ 54 SR_GetLongProperty.............. 30, 32, 43, 62
Parameters............................................. 54 SR Get Object Properties.......................... 11
PDF..................................................... 120 SR_GetObjects................................. 44, 63
PDFCreator........................................... 120 SR_GetObjectXML................................... 61
Picture Properties.................................... 97 SR_GetParent......................................... 69
Plugin Properties..................................... 86 SR_GetProperties.................................... 61
PowerPC.............................................. 119 SR_GetPtrProperty.................................. 62
Printing.................................................. 70 SR_GetRealProperty.......................... 10, 63
Printing with SuperReport Pro................... 47 SR Get Scripts........................................ 11
Properties........................................ 32, 83 SR Get Sections...................................... 11
SR_GetTextProperty................................ 64
Q SR_NewObject............................. 42, 67, 68
SR_NewObjectFromXML........................... 68
Quotes................................................. 123
SR_NewReport............................. 25, 26, 59
R SR_NewReportBLOB................................ 60
SRObjectID............................................ 15
Rectangle Properties................................ 96
SR_OpenSession..................................... 70
Registering Server licenses....................... 19
SR Package............................................ 12
Registering your SuperReport Pro Licence. 15, 16
SRPage.................................................. 15
Remote mode......................................... 19
SRP area................................................ 57
Repeating Objects................................. 119
SR_ParseReport...................................... 59
Report Properties.............................. 89, 90 SRP_DataSource_Callback.......................... 9
Result Code............................................ 54 SRP_DataSource_RelateMany..................... 9
S SRP_DataSource_RelateOne....................... 9
SRP_Export_HTML................................... 41
scripts................................................... 34 SRP_Print_DestinationFile........................ 70
Scripts............................................. 13, 33 SRP_Print_DestinationPDF........................ 70
Section Break Properties........................ 112 SRP_Print_DestinationPreview.................. 70
Section Markers.................................... 123 SRP_Print_WinOpenPreview...................... 70
Section Properties................................. 110 SRP_Report_CountPages.......................... 12
Setters.................................................. 65 SR_Print................................................ 74
Single-user license.................................. 22 SR_PrintBLOB......................................... 75
SRArea.................................................. 15 SR_PrintBLOBIntoPICT............................. 77
SR_Area_AddUndo.................................. 78 SR Print Disk.......................................... 12
SR_Area_ExecuteScript............................ 78 SR Print HTML........................................ 12
SR_Area_Redo........................................ 79 SR_PrintIntoPICT.................................... 76
SR_Area_SaveUndo................................. 78 SR_PrintSettings............................... 70, 76
SR_Area_Undo....................................... 79 SRP_Text_Dynamic.................................. 12
SR_ChangeObjectParent.......................... 67 SRRecord............................................... 15
SR_CloseSession..................................... 71 SR_Register..................................... 16, 57
SR_ColorPicker....................................... 79 SR RELATIONS.................................... 9, 11
SR_ConvertToXML........................ 10, 53, 58 SR_RunScript......................................... 80
SRDate.................................................. 15 SR_RunTokenizedScript............................ 80
SR_DeleteObject..................................... 67 SR_SaveReport....................................... 60
SR_DeleteReport..................................... 60 SR_SetLongProperty.......................... 42, 65
SR_DetokenizeScript............................... 80 SR SetPrinter.......................................... 11

126
Index

SR_SetProperties.............................. 62, 65 U
SR_SetPtrProperty.................................. 65
SR_SetRealProperty................................ 66 Undo buffer.......................................... 120
SR Set Script Callback......................... 9, 11 Unicode................................................. 13
SR_SetTextProperty........................... 42, 66 V
SRTime.................................................. 15
SR_TokenizeScript................................... 81 Variable Properties................................ 100
styled text.............................................. 13 Variables
Style Properties.................................... 114 39
Style Tags.............................................. 50 Variable Style Properties........................ 101
support.................................................... 8 Virtual structure.................................... 120

T W

Table object............................................ 13 Watermark............................................. 13


Table Properties.................................... 105 Watermark Properties............................ 112
Technical Support...................................... 8 Windows Preview.................................. 123
Text Properties........................................ 98 X
Text Style Properties................................ 99
TrueType fonts........................................ 13 XML........................................................ 8

127

You might also like