What is new

History
VisualEasyPDF
Last modified : 09/01/2007

4.21 ( 09-January-2007 )
 • Oracle supported.
• Changing connection now updates fields correctly.
• Using engine EasyReportPDF 1.12 for database connection.
4.20 ( 30-November-2006 )
 • Improved grid design.
• From the new button you can now select the kind of report, making the selection more clear for use.
• Database view has been also improved by using a tree data view.
• Unified bookmarks and database fields in one box named Util. Next release we will add more tabbed objects.
• Fixed several minor bugs.
4.11 ( 14-November-2006 )
 • Added the Marks parameters for charting options.
• Better handling for copy and paste functions.
• Fixed bug when copying and pasting shape boxes.
4.10 ( 17-July-2006)
 • Added the @PageCount function for the new release of easyReportPDF.
• Bug removed when setting two connections both were link to the detail band report.
• Added a popup menu in the database box which clarifies buttons menu and adds a new command to select a new default report band for the detail.
• Databases can be deleted. You may need to change all fields in report which points to the connection deleted if there is one if not the report will print it blank.
• Improved the cursor bitmap in report mode.
• Added more support for the image format by using latest component version of DImageEN.
• Sometimes the page was not responding to the cursor position when placing the first object.
4.06 ( 12-July-2006)
 • @Date function was not correctly being translated from VEP to aspEasyPDF source code in enterprise mode.
• Added all special report function in the text delimited write box to be selected for the user. Added for novice users.
4.05 ( 6-July-2006)
 • Reports drawn in inches wont open the report in the correct size
• Group reports can be changed from the band property
• Band property can now set the height of the band
• Closing the application displays a better close message and allows you to save and close it in one action.
• Checks for new versions when starting VisualEasyPDF, it can be disabled in the configuration window
 • Registered versions of VisualEasyPDF can now be started from network path without incurring a license problem.
 4.04 ( 5-July-2006)
 • Database connection has been improved with better timeouts connections and default port and user names.
• Sometimes the script for the report was not being saved in the VEP file.
• Now you can easily change the db connection.
4.03 ( 15-June-2006)
 • Window properties didn't allow to modify the position object.
• Barcode was not accepting the window in field object mode.
• Now in the title you see what has been change.
• Jump to a method in the script mode
• More fixes added.
4.02 ( 15-April-2006)
 • Moving objects by keyboard or by align controls updates correctly the positions
• Properties now updates correctly the positions of the selected object.
• You can update multiple objects from the property window.
• Selecting a field display in the status bar the connection and the field property.
• Visible band property now binds correctly to the draw in document property.
• Improved the wizard assistance for where conditions.
• Added jump functions on the scripter.
• Global parameters improved.
• Database wizard and view data now uses global parameters.
• You may now create multiple report documents from VisualEasyPDF wizard.
4.00 ( 30-January-2006)
 • MS Access, OCBC and Oracle database assistant complete
• Fixed the SQL interpretation for the source code
• When running the report you may cancel it by closing the status window
4.00 ß8 ( 21-October-2005)
 • DB Parameters didn't get blank set
• SQL is now stored with carriage return, making it clear
• Groups where not correctly displaying actual sets
• Visible Bands from the band property
• Inserting VEP files from the NEW button or from the Report Menu
• SetProperty was not using string values for integer ones in explicit functions like C# or Delphi
• Templates implemented, use the template folder to set your own templates
4.00 ß7 ( 21-October-2005)
 • Parameters users from VisualEasyPDF was not working any more.
• Corrected some functionality from the field expand setting.
• Added several functions for the script and making it compatible with easyReportPDF 1.05
4.00 ß6 ( 19-October-2005)
 • Added a new button for changing the connection string of a report after defining it.
• Corrected the source code translation for reports when it has script and parameters
• Compilation of easyReportPDF now save the report on the same path of the script if is in ASP
• Some scripts and some help references of the easyReportPDF has been added
4.00 ß5 ( 29-August-2005)
 • Shape with the same background were in black
• Added Wrapping and HTML fields
• Compiled with the latest version of aspEasyPDF Enterprise version 3.21
4.00 ß4 ( 22-August-2005)
 • Added easyReportPDF library
• Added aspEasyPDF Enterprise version coding features
• Wizard for database connection
• Script debugging with breakpoints and user watch values
• Correct thick line draw after loading
• Faster object selection
• Objects now gets a name
• Event object is gone by a contextual menu access
• Improved drawing elements
• VisualEasyPDF is not more a freeware edition, this change is due by adding the easyReportPDF library in the evaluation mode which enables you to Save and Load reports ( Those were disabled features on the free versions )

3.00 ( 31-December-2004 )
• Added Chart capability for beta version of aspEasyPDF

2.20 ( 21-December-2004 )
• Zoom was not working properly with fonts sizes
• Command Select all was not acting
• Commands send back and front were inverted.
• Selecting MITEasyPDF .NET and not selecting a default language was causing a ntdll failure
• French translation

2.10 ( 26-July-2004 )
• Redesigned the about, register and wizard box
• Selecting an object text automatically sets the properties as a default for new objects, on the configuration page you can disable this action.
• Better visual Themes integration on VEP
• Properties with scale factor was not getting the real value
• Properties works with real units specification
• Zoom with a Text formatted was making an exception
• Font size affects the formatted text.
• Color text could be not selected after
• Formatted Text was not working anymore it has been completely rewritten, now you can select print order, transparency, correct resize.
2.07 ( 29-June-2004 )
• Width custom size was identical to Height size
• Custom page size in different unit than mm was always using mm.
 2.06 ( 22-June-2004 )
• Compiled with aspEasyPDF 2.22
• Links were not being rendered on the PDF document
• TTF not correctly displayed when generating the PDF file and using special character sets.
• Using the new AddFont function instead of the SetTrueType function
2.05 (15-April-2004)
• Resize correctly an image when loading a VEP file or moving with pages
• ColdFusion script added and adapted the comments syntax to work properly
2.04 (12-March-2004)
• Thanks to Philipp Alexander Starkl for the German translation.
• Added support for C# language
• csPropGraphDashLine was not restoring it's default value.
2.03 (02-February-2004)
• Graphics translation was not working for the Shareware version and was using the AddBarCode function instead the correct one.
2.02 (29-January-2004)
• Splash - The finish button didn't work
2.01 (27-January-2004)
• Splash show correct page
• Loads correct background from shapes
• Renders correctly the boxes and forms
2.00 ( 22-January-2004 )
 • Added multiple graphics format for 2.0 release ( Security, Forms, Bookmarks, JavaScript )
• Generating PDF documents does not load the graphics again that was inserted on the document
( making more easy to export VEP document and faster generation )
• Better Lines support
• Ellipses and Rectangles with Shadows
• Round rectangles support
• Graphic effects ( color filters, angles, reductions )
• Compression levels
• Supports localization, available only on Spanish more to come
• Toolbars remembers positions after close
• Improved drawing tools when adding objects on the document
• Added MSAA support ( Microsoft Active Accessibility )
• Constant generations by name
• Allows source comments
• Improved UI ( buttons, menus and Themes )
• Added all new functions from aspEasyPDF 2.0
• Added support for MITEasyPDF .NET product

1.01 ( 06-10-03 )
 • Added US Letter for 8.5 x 14 inches size
• Added Name label for each object, this is a new option to interact with the aspEasyPDF 2.0 library
• Added C++ Builder code generation
• End string delimiter added for string function calls ( WideString ("") in C++ )
• After opening an existent file the dynamic translation didn't work
• Does not open the same file several times on the editor
• New keys color for Delphi, VB and ASP code
1.00 ( 26-09-03 )
 • Multiple run files
• Windows organization
• Dragging lines now draws shadow
• Pressing CTRL and Left mouse button you can select multiple objects or the one that it's difficult to grab
• Pressing on the form does not unselect the objects, now to deselect objects press Escape key
• Better source detect change
• New message to control the source translation
• New message to save the source code translation
• Transparent boxes
• You can delete multiple objects
• Improved speed of object selection by the mouse
• Implemented the mouse wheel on the Document editor

0.99 RC2c ( 26-08-03 )
• Multiple selections was not working, again!
• Now on text field if it's starts with the @ character then is not converted to string, this is ideal to use variables directly on the printing function
0.99 RC2b ( 25-08-03 )
• Fixed the selecting object cursors.
• Multiple selections was not working
• Save and load was not saving the appropriate page size
• Property button was not refreshed when loading directly from the MRU list
• Loading from the shell a VEP file with a big filename and blank spaces was loading multiple files, this has been corrected
• About page now shows the internal PDF library version
0.99 RC1 ( 10-07-2003 )
 • This is the first version after this version we will start to notify every change on the history page


Contents

General page information
VisualEasyPDF
Last modified : 09/01/2007 ( Version 4.21 )
What's VisualEasyPDF

It's a visual document editor program that enables you to create PDF documents by drawing in a real WYSIWYG environment by using your mouse and placing objects on the document.

But, what makes this one different from the others?
As you may known MITData is company dedicated to programmers and web solutions, our best seller program solution is the aspEasyPDF library to make PDF documents in real time. This library, as all other programming libraries, as a learning curve that increases with time, but as far as you known we never have time to read a documentation or even the best help file wrote to explain the library.
This is why we created a program that in combination with the library, some small time to place objects in a document and pressing a button, it will create all code for you. And the best of all, you can even press compile and run* and you will see it running on your web site. The learning curve has gone and you even can work with the library without knowing how to use it.
At this moment VisualEasyPDF can work with different languages; ASP, ASP.NET, Delphi, Borland Builder C++,VB Script and VB.

I'm not a programmer, I just want to create a PDF document, can I use it?
Yes!, when you first run the VisualEasyPDF it will start with a Setup Wizard, it will ask you if you want to use it as a programming environment or as a visual PDF design tool. If you select to use it as a design tool then you wont see any editor source to program. Design your document and generate the final PDF document.

Undecided to buy this component!, then see the following page to see how many clients are just working with our components.

Contact us at: support@mitdata.com or visit us at: www.mitdata.com backup server at www.mitdata.net

Thanks to Philipp Alexander Starkl for the German translation and Guillaume Schmittlin for French translation.

The VisualEasyPDF uses ImageEn ( Image Processing Components ) for the image render solution. Copyright © 1998-2007 by HiComponents. http://www.hicomponents.com


FAQs
VisualEasyPDF
Last modified : 09/01/2007
FAQs

Please see the forums section to get an updated problems and solutions. This is the most common FAQ that has been extracted from the forums.

• I'm from a Marketing department and I want to use
VisualEasyPDF as a PDF creation solution,
can I use it or is just for programmers?

Sure!, when you first run the VisualEasyPDF it will start with a Setup Wizard and will ask you if you want to use it as a programming environment or as a visual PDF design tool. If you select to use it as a design tool then you wont see any programming section.
Just design your document and generate the final PDF document. Remember that the free edition will draw only just one PDF page, but without nags and any other limitation.

• How can I load a PDF document?

You can not load a PDF document, even on the registered version. The main reason is that the PDF documents are created in a batch sequence to be interpreted, this is quite complex and will require to much time to decoded and translate it to the VEP standard. From version 2.0 the aspEasyPDF library can read VEP files, even you can change it dynamically from the library by using the name objects.

• If I buy the VisualEasyPDF, how much will take to unlock the program?

If you purchase the program on our eCommerce site then the unlock code and the invoice will be sent by email in 5 minutes.


Tutorials
VisualEasyPDF
Tutorials

You can find updated tutorials on our web site, please go to the following location:

Help tutorials


Keyboard
VisualEasyPDF
Last modified : 09/01/2007
Keyboards for the Document editor

You can use the keyboard to manage the design of the document.

Key | Description
Cursors | Select an object
Tab | Next object
Shift + Tab | Previous object
Shift + Cursor | Sizes selected object
Ctrl + Cursor | Moves selected object
Shift + Mouse | Select individual objects
Ctrl + Mouse | Selects objects by a rectangle region
ESC | Unselects objects


Known problems
VisualEasyPDF
Last modified : 09/01/2007
Known problems

• Some database connections are not supported in VisualEasyPDF

• Copy / Paste is not full supported

• Improvement in the EasyReportPDF script code

• This help file has to be complete


Creating first document

Creating a document

When creating a document you are present by this screen. To know more about each tab click on the link tab:

Information - Page - Output - Security - Source - ASP

Document type

Blank page; You will start with a blank page and your are free to draw whatever on that page.

Database report; Helps you to create a real-time report database, it will ask you for database connection, then place the fields and run the report.

Templates; Select a default pre made page

1. Page

Specifies the page size, working units and margins.

Work with unit
Which units are you more comfortable to work with. AspEasyPDF works internally with pixels and convert this to acrobat units. You may use metrics or inches measures as well.

Page properties - Size
Select a custom size for the page. By default is set to A4, but can be change it to any other. Using the Custom value you may use a user defined size that is introduced in the Height and Width box.

Page properties - Orientation
Work with Portrait or Landscape page orientation.

Page properties - Background
Sets a different color for the background.

Page properties - ( Height and Width )
When selecting a custom size for the page you use a user defined size that is introduced in the Height and Width box.

Margins
Establish the margins to be use when coding in aspEasyPDF.

2. Information

Introduce the information of the PDF document that will be created. This is important to keep it to date for later use advanced search engines which will take care of this information on your PDF document.

3. Output

Set different options for the document output.

Document compression
Establish a compressed document. This will take more time to generate the document because it has to compress the whole PDF, but you will gain in size. You may expect a reduction of 1:3 but this may vary if there are images, as those are always compressed.

Opening option
Fit window to screen - Will size the whole page view to the current window.
Full screen view - You will see the PDF in full screen.

Graphics
Graphic compression method for JPG ( which is a loose quality compression )

4. Security

Adds security to your PDF to not allow viewing.

Password
User - Will ask the user for the password set and will not allow to open and view the PDF if the password is not correct.
Owner - Password to make changes to the PDF document, is different from the User which is only for viewing it. If you set encryption and you don't set an owner password then aspEasyPDF will use an random password to protect the document for changes.

Permissions
Different permissions for the user

Encryption type
40 bits - Standard encryption that works from Acrobat 3.0
128 bits - Stronger encryption that works from Acrobat 5.0

5. Source

If you use VisualEasyPDF to generate the source code of your drawing object, then you need to specify for which library and which programming language you use.

Library
Select the MITData library to work with VisualEasyPDF. You have 3 options products to work with and in the near future we may add more. Select your installed product to work with.

Programming language
Use the programming language for the selected library. You may add your own programming language by manipulating the bin directory folder.

Do not use programming environment
If you use VisualEasyPDF to only draw VEP forms and use them to generate the documents without the need to see the source code, then this option will help to release some memory and confuse you in multiple windows.

Use constants names when translating
When translating the global constants as default use the number constant, if this option is set then it will use the names that are specified in the constant file.

6. ASP

Additional properties for the ASP and ASP.NET source code. This properties allows you to make compilations directly to the browser and see the effects immediately.

Web directory
When compiling it will save the source code to the following directory specified by you.

Web URL
Web address according to the directory you have previously set in the Web directory.


Generating source code

Topic under construction


Options

Topic under construction


Introduction

Topic under construction


Bookmarks

Topic under construction


Drawing

Topic under construction


Properties - Link

Topic under construction


Properties - Graphic

Topic under construction


Properties - Barcodes

Topic under construction


Properties - Shape

[[TOPIC HERE]]


Properties - Text

[[TOPIC HERE]]


Properties - Chart

Topic under construction


Introduction

Database report Introduction

From version 4.0 VisualEasyPDF has introduced the report generation which helps from EasyReportPDF and aspEasyPDF Enterprise* libraries to design and create reports without any acknowledge of programming.

Each library is designed for different purposes, refer manual to get more knowledge about the differences between EasyReportPDF and aspEasyPDF, but VisualEasyPDF includes visual design for both libraries. You may design one database report for both libraries without losing compatibility.

To known how to create some database reports we suggest you to see the tutorials on the internet site:

Tutorials of VisualEasyPDF

Or you may follow this help file to understand how it works.

1. Creating a new report

2. New database connection

*The enterprise version of aspEasyPDF adds EasyReportPDF library into aspEasyPDF and gives you the feature of creating real-time database reports.


Supported databases

VisualEasyPDF supports the following list of different databases types;

ADO - Sets an ADO connection which enables you to connect to practically to all databases which provides a driver for ADO.
FireBird - Free Relation database which offers SQL-92 standard instruction sets. Runs in many platforms. Web page.
InterBase - Borland® InterBase®, web page.
msSQL - The Microsoft SQL server. Web information page.
MySQL - The mySQL server from 3.12 to 5.x Web page.
Oracle - Oracle. Web page.
Sqlite - C library that implements a self-contained, embeddable, zero-configuration SQL database engine. Linux, Windows. Web page.
Sybase - Sybase databaser. Web page.

Databases implementation status;

Status in VisualEasyPDF
Name | Wizard | Query Manager | SQL Advanced | Report
ADO | YES | YES | YES | YES
msSQL | YES | YES | YES | YES
mySQL | YES | YES | YES | YES
Oracle | NO | NO | NO | YES
Firebird | NO | NO | NO | YES
InterBase | NO | NO | NO | YES
Sqlite | NO | NO | NO | YES
SyBase | NO | NO | NO | YES


New database connection wizard

New database connection

1. Selecting the connection

On this first window that appears when creating a new database report or by adding more connections to your report ( you may have different connections for your report, even different databases but only one is the loop connection and is defined in the detail band ).

Connections
Select the connection type of your database

Saved definitions
You will see all connections that has been saved. Click on it and you will go to the next step with all database connection information filled.

2. Connection settings

By the database type this window will vary for introducing all settings of the connection.

Host
Is the server which the database is located. Introduce the IP address or the Host name to be solved.

Port
Associated with the TCP/IP address, this is to specify a different port number for the connection. If you want to leave as default then set it to 0

Database
Database to connect for. Some SQL servers may have more than one databases to connect, if this is supported by the SQL server then it will show the different database available to connect.

User
User to connect to the database service

Password
Password to connect to the database service

Get available DB
Click this button to get all known databases for the current connection.

Test Connection
Test the connection to see if it is right defined.

Save definition
After introducing all settings you may save the definition for new database reports which you don't want to enter each time the same settings.

3. Table Selection

Select the tables you wish to work with. Pressing CTRL you may select different tables to later join them.

3. Query editor

This step will allow you to join different tables together and select the output fields.

For joining two tables you must select source field with the mouse and drag it to the destination field; this will create a visual link line that can

4. Condition filtering

Add conditions to your report. Those conditions can be fixed value or dynamic. For dynamic values you should see the Parameters section to learn how to add new parameters which may be user selection or hidden for global vars.

This wizard adds all conditions for AND tag, you may change later in the SQL Advanced if you need to add OR or to set complex selections.

5. Group breaking

Sets the fields that will use group breaking. Group breaking is a special report management band which you can set up to 10 different breaks on your report to allow the report break and report different parts. For example you may set break for CusomerID to show all orders for each customer.

Note: For advanced users. The SQL does not use GROUP BY function, it use it's own technique to simplify the data construction and adds this in the ORDER BY clausal. So be careful when changing the SQL in the SQL Advanced window.

6. Sort fields

Select the field you wish to get sorted on the report.

7. SQL Advanced

Review or change the SQL. Be careful when changing the SQL because you can get unexpected results if is not correctly done.

8. Results

Displays the results. If there is an error in the SQL you will see an error message that you may go back to correct the SQL.


Changing database connection

If you need to add a new field, use a new table, sort by a different field, or whatever change that has to be done in the SQL you have no way to go to the wizard again. Press on the connection properties and you will see the SQL Advanced window, from there change anything from the SQL.


Adding fields to the report

After completing the wizard for the new database report you should see on the screen a name connection, click into the name connection and you will see a list of fields.

To use one of them in the report you should click on the field and drag to the band you will want to print.


Grouping reports

Topic under construction


Band types

Topic under construction


Parameters

If you need to use global parameters or user input, for example to ask for an Invoice number to be print or selecting a range value, then you need to first specify the parameters in the report.

For later use it in the SQL you should add a double dot ( : ) before the name connection to make the reference to it.

SQL Advanced:

SELECT * FROM Customers
WHERE Customer_ID = :CustomerID

EasyReport Script:

// If the user didn't set a any value then 10000
value := GetPropObj('CustomerID', 901);
if value = 0 then
     SetPropObj('CustomerID', 901, 10000);

csPropERPParamValue is 901 ( see EasyReport help )

User parameter dialog:


Wrap field contents

Wrap fields

Some times you need that the field expand his contents because it may be a memo field that it's size may vary depending on its data. This is complex to manage by your self but EasyReportPDF will do this for you and VisualEasyPDF is the right tool to help you manage it.

To select a expandable field contents you just have to select the field, go to the properties and select "Expand contents if needed". This will increase the band size to make fit the field.

You may run in some troubles if you need that some fields or shapes has to be on the end of the band. As all object are positioned in absolute coordinates, if the band grows you will get some object on its original place, but you may need to move those object to an absolute position to the end of the band size. To learn how to position an object in a relative coordinate press here.


Relative positioning

If you need that some fields or shapes placed to the end of the band and there are expandable fields which makes the band grow, it may miss place the object.

All object are positioned in absolute coordinates, if the band grows you will get some object on its original place, but you may need to move those object to an absolute position to the end of the band size. To set an object to use relative position set the relative option in the object property.

Example:

On this visual example we set the shape line to be in a relative positioning and the "Texto" is an expandable field. Please take a look on the final PDF on the second image.


Pascal reference

Pascal syntax
easyReportPDF executes internal event scripts written in Pascal syntax. This provides fast and easy programming in the reports.

Current Pascal syntax supports:

• begin .. end constructor
• procedure and function declarations
• if .. then .. else constructor
• for .. to .. do .. step constructor
• while .. do constructor
• repeat .. until constructor
• try .. except and try .. finally blocks
• case statements
• with statements
• as / is statements
• array constructors (x:=[ 1, 2, 3 ];)
• ^ , * , / , and , + , - , or , <> , >=, <= , = , > , < , div , mod , xor , shl , shr operators
• access to object properties and methods ( ObjectName.SubObject.Property )

Script structure
Script structure is made of two major blocks: a) procedure and function declarations and b) main block. Both are
optional, but at least one should be present in script. There is no need for main block to be inside begin..end. It could be
a single statement. Some examples:

SCRIPT 1:
procedure DoSomething;
begin
CallSomething;
end;
begin
CallSomethingElse;
end;
SCRIPT 2:
begin
CallSomethingElse;
end;
SCRIPT 3:
function MyFunction;
begin
result:='Ok!';
end;
SCRIPT 4:
CallSomethingElse;

Like in pascal, statements should be terminated by ";" character. Begin..end blocks are allowed to group statements.

Identifiers
 Identifier names in script (variable names, function and procedure names, etc.) follow the most common rules in pascal :
should begin with a character (a..z or A..Z), or '_', and can be followed by alphanumeric chars or '_' char. Cannot contain
any other character os spaces.
Valid identifiers:
VarName
_Some
V1A2
_____Some____
Invalid identifiers:
2Var
My Name
Some-more
This,is,not,valid

Assign statements
Just like in Pascal, assign statements (assign a value or expression result to a variable or object property) are built using
":=". Examples:

MyVar:=2;
Button.Caption:='This ' + 'is ok.';

Character strings
 strings (sequence of characters) are declared in pascal using single quote (') character. Double quotes (") are not used.
You can also use #nn to declare a character inside a string. There is no need to use '+' operator to add a character to a
string. Some examples:

A:='This is a text';
Str:='Text '+'concat';
B:='String with CR and LF char at the end'#13#10;
C:='String with '#33#34' characters in the middle';

Comments
Comments can be inserted inside script. You can use // chars or (* *) or { } blocks. Using // char the comment will
finish at the end of line.

//This is a comment before ShowMessage
ShowMessage('Ok');
(* This is another comment *)
ShowMessage('More ok!');
{
And this is a comment
with two lines }
ShowMessage('End of okays');

Variables
There is no need to declare variable types in script. Thus, you declare variable just using var directive and its name.
There is no need to declare variables if scripter property OptionExplicit is set to false. In this case, variables are implicit
declared. If you want to have more control over the script, set OptionExplicit property to true. This will raise a compile
error if variable is used but not declared in script. Examples:

SCRIPT 1:
procedure Msg;
var S;
begin
S:='Hello world!';
ShowMessage(S);
end;
SCRIPT 2:
var A;
begin
A:=0;
A:=A+1;
end;
SCRIPT 3:
var S;
S:='Hello World!'
ShowMessage(S);

Note that if script property OptionExplicit is set to false, then var declarations are not necessary in any of scripts above.

Indexes
Strings, arrays and array properties can be indexed using "[" and "]" chars. For example, if Str is a string variable, the
expression Str[3] returns the third character in the string denoted by Str, while Str[I + 1] returns the character
immediately after the one indexed by I. More examples:

MyChar:=MyStr[2];
MyStr[1]:='A';
MyArray[1,2]:=1530;
Lines.Strings[2]:='Some text';

Arrays
Script support array constructors and support to variant arrays. To construct an array, use "[" and "]" chars. You can
construct multi-index array nesting array constructors. You can then access arrays using indexes. If array is multi-index,
separate indexes using ",".
If variable is a variant array, script automatically support indexing in that variable. A variable is a variant array is it was
assigned using an array constructor, if it is a direct reference to a Delphi variable which is a variant array (see Delphi
integration later) or if it was created using VarArrayCreate procedure.
Arrays in script are 0-based index. Some examples:

NewArray := [ 2,4,6,8 ];
Num:=NewArray[1]; //Num receives "4"
MultiArray := [ ['green','red','blue'] , ['apple','orange','lemon'] ];
Str:=MultiArray[0,2]; //Str receives 'blue'
MultiArray[1,1]:='new orange';

If statements
There are two forms of if statement: if...then and the if...then...else. Like normal pascal, if the if expression is true, the
statement (or block) is executed. If there is else part and expression is false, statement (or block) after else is execute.
Examples:

if J <> 0 then Result := I/J;
if J = 0 then Exit else Result := I/J;
if J <> 0 then
begin
Result := I/J;
Count := Count + 1;
end
else
Done := True;

While statements
A while statement is used to repeat a statement or a block, while a control condition (expression) is evaluated as true.
The control condition is evaluated before the statement. Hence, if the constrol condition is false at first iteration, the
statement sequence is never executed. The while statement executes its constituent statement (or block) repeatedly,
testing expression before each iteration. As long as expression returns True, execution continues. Examples:

while Data[I] <> X do I := I + 1;
while I > 0 do
begin
if Odd(I) then Z := Z * X;
I := I div 2;
X := Sqr(X);
end;
while not Eof(InputFile) do
begin
Readln(InputFile, Line);
Process(Line);
end;

Repeat statements
The syntax of a repeat statement is repeat statement1; ...; statementn; until expression where expression returns a
Boolean value. The repeat statement executes its sequence of constituent statements continually, testing expression after
each iteration. When expression returns True, the repeat statement terminates. The sequence is always executed at least
once because expression is not evaluated until after the first iteration. Examples:

repeat
K := I mod J;
I := J;
J := K;
until J = 0;
repeat
Write('Enter a value (0..9): ');
Readln(I);
until (I >= 0) and (I <= 9);

For statements
Scripter support for statements with the following syntax:
for counter := initialValue to finalValue [step X] do statement
or:
for counter := initialValue downto finalValue [step X] do statement

For statement set counter to initialValue, repeats execution of statement (or block) and increment/decrement value of
counter optionally with step X until counter reachs finalValue. Examples:

SCRIPT 1:
for c:=1 to 10 do
a:=a+c;
SCRIPT 2:
for i:=a to b do
begin
j:=i^2;
sum:=sum+j;
end;

Case statements
Scripter support case statements with following syntax:

case selectorExpression of
caseexpr1: statement1;
...
caseexprn: statementn;
else
elsestatement;
end

if selectorExpression matches the result of one of caseexprn expressions, the respective statement (or block) will be
execute. Otherwise, elsestatement will be execute. Else part of case statement is optional. Different from Delphi, case
statement in script doesn't need to use only ordinal values. You can use expressions of any type in both selector
expression and case expression. Example:

case uppercase(Fruit) of
'lime': ShowMessage('green');
'orange': ShowMessage('orange');
'apple': ShowMessage('red');
else
ShowMessage('black');
end;

Function and procedure declaration
Declaration of functions and procedures are similar to Object Pascal in Delphi, with the difference you don't specify
variable types. Just like OP, to return function values, use implicited declared result variable. Parameters by reference
can also be used, with the restriction mentioned: no need to specify variable types. Some examples:

procedure HelloWord;
begin
ShowMessage('Hello world!');
end;
procedure UpcaseMessage(Msg);
begin
ShowMessage(Uppercase(Msg));
end;
function TodayAsString;
begin
result:=DateToStr(Date);
end;
function Max(A,B);
begin
if A>B then
result:=A
else
result:=B;
end;
procedure SwapValues(var A, B);
Var Temp;
begin
Temp:=A;
A:=B;
B:=Temp;
end;


Events supported

Events

easyReportPDF is event oriented object, this means that for any band, page, or DBField in report that is printed before or after, will fire an event which the dessigned report may act in the user programmed way.

Report_OnStart

Before drawing the report it will fire this event script. There are no parameters set and does not return any value.

Report_OnEnd

When report has ended to print the entierly report.

Details_OnPrintBefore

Before drawing the detail band it will fire this event script. There are no parameters set.

Note: You should always return true or false to that event. Set to True if you want to print the details or to false to not print it.

[OBJECTNAME FIELD]_OnPrintBefore

Before drawing the object field it will fire this event script. There is one parameter which points to the contents of the field

If you set a return value, then it will print the return value and not the contents of the field.

[OBJECTNAME FIELD]_OnPrintAfter

After drawing the object field it will fire this event script. There is one parameter which points to the printed value, not the field value.

No return values.

[OBJECTNAME TEXT]_OnPrintBefore

Before drawing the object text it will fire this event script. There is one parameter which points to the contents of the object text

If you set a return value, then it will print the return value and overrides the object text.


Internal functions

easyReportPDF supports some internal functions in the script that may be the same that you may use in the library.

AddTextWidth ( Left, Top, Width : double; Text : string )

Adds text to the current document.

AddGraphicPos ( Left, Top : double; Graphic_Path : string )

Adds a graphic image to the current document.

TDataSet = DBDataSet ( Connection_Name : string )

The DBDataSet function returns the TDataSet object class ( more information in the TDataSet class in the Global variable help menu ) for the given connection name. If is not found then return nil.

TField = DBField ( Field_Name : string )

The DBField function returns a TField object class ( more information in the TField class in the Global variable help menu ) for the given field name. If is not found then return nil.

You may specify a connection name if you have more than one connection and the field maybe defined in both connection. To do that just put the name of the connection plus a dot separation and then the field name. (for example: DBField( 'connection4.customernr' ) )

TZQuery = DBQuerySQL ( Connection_Name : string ; SQL : string )

Returns a TZQuery structure for the SQL and the connection name provided.

Integer = DBExecSQL ( Connection_Name : string ; SQL : string )

Runs a SQL syntax ( UPDATE, INSERT or DELETE, you may also call procedure stores ). Returns row affected.

string = getParameter ( ParameterName : string )

string = getProperty ( Property_ID : integer )

Returns a property of the PDF document, to known which property to use see aspEasyPDF or easyReportPDF help manual.

string = getPropObj ( ObjectName : string; Property_ID : integer )

Returns a property of an object of the PDF document, to known which property and get more information on this function see aspEasyPDF or easyReportPDF help manual.

setParameter ( ParameterName : string; Value : string )

setProperty ( Property_ID : integer; Value : string )

Sets a property of the PDF document, to known which property to use see aspEasyPDF or easyReportPDF help manual.

setPropObj ( ObjectName : string; Property_ID : integer; Value : string )

Sets a property of an object for the PDF document, to known which property and get more information on this function see aspEasyPDF or easyReportPDF help manual.


Global variables

PosXCursor

Gets or set the position of the X Cursor.
Note: Using wrong this variable may render incorrectly the report.

PosYCursor

Gets or set the position of the Y Cursor.
Note: Using wrong this variable may render incorrectly the report.

PageNumber

Gets the actual page number.

PageCount

Gets the actual page count.
Note: Retrieves the actual page count, which may be not the final number.

Version

Returns the actual version of the library which uses to render the report.

NVersion

Returns the actual version number of the library which uses to render the report.
Note: Use this variable to use compatible functions on the script or request before rendering the report to avoid old version errors.

TDataSet Class

TDataSet is the ancestor class for TTable, TQuery, and TStoredProc ( Delphi classes ). As such, most properties, methods, and events that these classes use are actually defined by TDataSet. Because so many characteristics of the derived classes come from TDataSet, I'll list the primary properties, methods, and events of TDataSet here, and later I'll list the properties, methods, and events particular to each derived class.

Table 16.1 lists the most commonly used properties of the TDataSet class, Table 16.2 lists the primary methods.

TABLE 16.1. PRIMARY TDataSet PROPERTIES.

Property | Description
Active | Opens the dataset when set to True and closes it when set to False.
AutoCalcFields | Determines when calculated fields are calculated.
Bof | Returns True if the cursor is on the first record in the dataset and False if it isn't.
CachedUpdates | When True, updates are held in a cache on the client machine until an entire transaction is complete. When False, all changes to the database are made on a record-by-record basis.
CanModify | Determines whether the user can edit the data in the dataset.
DataSource | The DataSource component associated with this dataset.
DatabaseName | The name of the database that is currently being used.
Eof | Returns True if the cursor is at the end of the file and False if it isn't.
FieldCount | The number of fields in the dataset. Because a dataset might be dynamic (the results of a query, for example), the number of fields can vary from one dataset request to the next.
Fields | An array of TFields objects that contains information about the fields in the dataset.
FieldValues | Returns the value of the specified field for the current record. The value is represented as a Variant.
Filter | An expression that determines which records a dataset contains.
Filtered | When True, the dataset is filtered based on either the Filter property or the OnFilterRecord event. When False, the entire dataset is returned.
FilterOptions | Determines how filters are applied.
Found | Indicates whether a find operation is successful.
Handle | A BDE cursor handle to the dataset. This is used only when making direct calls to the BDE.
Modified | Indicates whether the current record has been modified.
RecNo | The current record number in the dataset.
RecordCount | Returns the number of records in the dataset.
State | Returns the current state of the dataset (dsEdit, dsBrowse, dsInsert, and so on).
UpdateObject | Specifies the TUpdateObject component to use for cached updates.
UpdatesPending | When True, the cached update buffer contains edits not yet applied to the dataset.

TABLE 16.2. PRIMARY TDataSet METHODS.

Method | Description
Append | Creates an empty record and adds it to the end of the dataset.
AppendRecord | Appends a record to the end of the dataset with the given field data and posts the edit.
ApplyUpdates | Instructs the database to apply any pending cached updates. Updates are not actually written until the CommitUpdates method is called.
Cancel | Cancels any edits to the current record if the edits have not yet been posted.
CancelUpdates | Cancels any pending cached updates.
ClearFields | Clears the contents of all fields in the current record.
CommitUpdates | Instructs the database to apply updates and clear the cached updates buffer.
Close | Closes the dataset.
Delete | Deletes the current record.
DisableControls | Disables input for all data controls associated with the dataset.
Edit | Enables editing of the current record.
EnableControls | Enables input for all data controls associated with the dataset.
FetchAll | Gets all records from the cursor to the end of the dataset and stores them locally.
FieldByName | Returns the TField pointer for a field name.
FindFirst | Finds the first record that matches the current filter criteria.
FindNext | Finds the next record that matches the current filter criteria.
FindLast | Finds the last record that matches the current filter criteria.
FindPrior | Finds the previous record that matches the current filter criteria.
First | Moves the cursor to the first record in the dataset.
FreeBookmark | Erases a bookmark set previously with GetBookmark and frees the memory allocated for the bookmark.
GetBookmark | Sets a bookmark at the current record.
GetFieldNames | Retrieves a list of the field names in the dataset.
GotoBookmark | Places the cursor at the record indicated by the specified bookmark.
Insert | Inserts a record and puts the dataset in edit mode.
InsertRecord | Inserts a record in the dataset with the given field data and posts the edit.
Last | Positions the cursor on the last record in the dataset.
Locate | Searches the dataset for a particular record.
Lookup | Locates a record by the fastest possible means and returns the data contained in the record.
MoveBy | Moves the cursor by the specified number of rows.
Next | Moves the cursor to the next record.
Open | Opens the dataset.
Post | Writes the edited record data to the database or to the cached update buffer.
Prior | Moves the cursor to the previous record.
Refresh | Updates the data in the dataset from the database.
RevertRecord | When cached updates are used, this method discards changes previously made to the record but not yet written to the database.
SetFields | Sets the values for all fields in a record.
UpdateStatus | Returns the current update status when cached updates are enabled.

TField Class

The TField class represents a field (column) in a database. Through the TField class, you can set a field's attributes. These attributes include the data type (string, integer, float, and so on), the size of the field, the index, whether the field is a calculated field, whether it is required, and so on. You can also access or set a field's value through properties such as AsString, AsVariant, and AsInteger.

Accessing Fields

Before you can get or set the field value, you need some way of locating a field. There are at least three ways to do this:

  • By its pointer name

  • By the Fields property of TDataSet

  • By the FieldByName method of TDataSet

Accessing a field by its pointer name is probably the least used method. It works only if you have previously added fields to your project using the Fields Editor. When you add fields via the Fields Editor, Delphi creates a pointer for each field by combining the table name with the field name. If you have a table called Table1 and a string field called FirstName, Delphi would create a TStringField pointer called Table1FirstName. You could use this pointer to access a field:

Table1FirstName.Value := `Per';

The problem with this approach is that you don't always need to add fields using the Fields Editor.

The Fields property offers another way of accessing a field--by position. If you know that the LastName field is the first field in the table, you can use something like this:

Edit1.Text := Table1.Fields[0].Value;

The problem with this approach, of course, is that you have to know the exact order of fields.

Of the three ways of accessing fields, the most commonly used and reliable is the FieldByName method. Using FieldByName, you have to know only the name of the field to access the field:

Table1.FieldByName(`LastName').AsString := Edit1.Text;

FieldByName returns a TField pointer. To make it more understandable, let me break down the preceding line of code:

var Field : TField; begin Field := Table1.FieldByName(`LastName'); Field.AsString := Edit1.Text; end; In most cases, FieldByName is the way to go. Oh, you might be wondering which record is modified when you execute the preceding code. All these techniques retrieve the field from the current record.

Retrieving and Setting Field Values

After you obtain a pointer to a particular field, you can change its value by using the Value property or any of the As properties (by As properties I mean AsString, AsInteger, AsDateTime, AsBoolean, and so on). These properties perform conversions from one data type to another. Naturally, you can't always be assured that a conversion can be made. For example, if you try to convert a string field containing Smith to an integer, an exception will be thrown.

Setting a field's value is simple when you know the secret of FieldByName:

Table1.Edit; Table1.FieldByName(`LastName').AsString := Edit1.Text; Table1.Post;

First, the Edit method is called to put the table in edit mode. If you fail to call Edit, you will get an exception when you try to modify a field's value. After the table is put in edit mode, the field's value is set. In this case I used AsString instead of the Value property. For a string field, it's the same thing in either case. Finally, the Post method is called to post the edit to the database (or the update cache if CachedUpdates is on). That's all there is to it. Retrieving a field's value is just as easy:

var AcctNo : Integer; begin AcctNo := Table1.FieldByName(`ACCT_NBR').Value; { More code here. } end;


Report function fields

You may add more functionality by using the report text field function. Those internal functions works when the report triggers it's display and you have date functionality, report sums, page numbering and more easy functions.

How to set up a report field? just go to the VisualEasyPDF in report mode, then select the text object and put it on a band. It will display a box to write down the text, just write down on of following functions:

Function | Description
@Page | Prints the current page number in the actual page
@Sum Summarizes a field. First parameter is the field and the second one is a boolean value that specifies if the totalized values has to be reset to 0.

Ex: @Sum(Connection4.Price, true );

@Max | Maximum value of a field data
@Min | Minimum value of a field data
@Date Prints date in page:

Ex: @Date();

@Time | Prints the time in the current page
@DateTime | Prints the date time in the current page
@Param Prints on the page the current value of the global parameter. See parameters in VisualEasyPDF.

@Param('OrderID')

Note: If you really need to print the @Date text in the report and you don't want that the reporter prints the date, then just add another @ symbol and it will ignore the report function

@@Date(); will print @Date(); on the report and not the actual date.


Samples

Example from the erp_orders tutorial:

  • We define a total global variable which is a double type to hold the total price
  • The function Report_OnStart is called when the report starts to render
  • Before printing the text40 object it fires the text40_OnPrintBefore function, this calculates the discount price if it has and add the value to the total global value.
  • See that the DBField function retrieves the actual value
  • The text51_OnPrintBefore formats the total value to a monetory decimal display
  • The text54_OnPrintBefore sets the version of the library and prints it on the report
{ Global variables
}
var
  total : double;

{ This is called just when the report start to render, before openning connection.

}
function Report_OnStart
begin
  total := 0;
end;

{ Calculate each line price with it's discount and add it to the total
}
function text40_OnPrintBefore
var
  price : double;
begin
  price := DBField('UnitPrice').asFloat * DBField('Quantity').asFloat;
  if DBField('Discount').asFloat <> 0 then
  begin
   price := price - ( ( price * DBField('Discount').asFloat ) / 100 );
  end;
  total := total + price;
  Result := Format( '%.2n $', [price] );
end;

{ Before printing the total format it
}
function text51_OnPrintBefore
begin
  // Degug
  /// ShowMessage ( total );
  Result := Format( '%.2n $', [total] );
end;

function text54_OnPrintBefore
begin
  Result := 'Report generated with ' + Version + ' version in real-time';
end;

Example from the erp_invoices_month:

  • This scripts shows you how to manipulate object property to make the report render dinamically.
  • The function is called for each detail band print
  • If the ExtendPrice is grater than 300 US dollars, then changes the Font to F2 ( which is bold ) and sets the color to blue
  • if the price is lower than 300 dollars then restablish the font to F1 and the color to black
  • Sets to true the result to say to the library to print the band.
{ This function is called before printing each record
}
function Details_OnPrintBefore
begin
  // Check the ExtendedPrice field if it's greater than 300 US$
  if DBField('ExtendedPrice').asFloat > 300 then
  begin
    // Change Font and color text of the field11 object
    SetPropObj('field11', 100, 'F2');
    SetPropObj('field11', 103, '#0000FF');
  end
  else
  begin
    // Restore Font and color text of the field11 object
    SetPropObj('field11', 100, 'F1');
    SetPropObj('field11', 103, '#000000');
  end;
  // Render the record
  Result := True;
end;


About HTMLHelp ePublisher

This eDocument Was Created Using:
HTMLHelp ePublisher
Electronic-Documentation Creation Made Easy

Free to Download From:
http://www.htmlhelp-epublisher.co.uk

Also Available Web2HTMLHelp (Freeware)