Back to Home
Visual Graph Home
TriSun Software Inc. Home

Visual Graph Site Menu
Home
What is Visual Graph?
Screenshots
50 Technical Features
Getting Started
Abundant Graphic Libraries
File Format
FAQ
Online Demo (IE Only)
Common Applications
Visual Graph Getting Started
Use VG Component in Delphi 6
Use VG Component in VB6
Use Graphic Library
Change Element's Shape
Customize Property
Make Graphic Button
Get the Selected Elements
Dynamically Create Graph
Movable Label
Link Point
Access Properties
Use Line Vertexes
Call Windows API Functions
Call Visual Graph Functions
Callback Control Event in Script
Drag Graph in Run Mode
Detail Report
Make and Use Dialog Box

Visual Graph Getting Started - Detail Report

You need to design a template first to make any report, the detail report template is bin\report.tbl. Now we use it to make an employee report in Delphi.

Please follow these steps to make it.

1. Create a new file in Visual Graph IDE, click File -> Set page... menu item and check Show paper option, and then click Tools -> Document settings... menu item and check Paper as work area option, save current document as h:\template1.tbl.

2. Draw the title (use autosizerect basic element in library group) and a table (Table -> New table... menu item) like this:

Detail Report 1

3. Select the table through drawing a rectangle area by mouse, click Edit -> Groups... menu item to create group1 like below, and then click this dialog box and save current document.

Detail Report 2

4. Create a new application in Delphi and place a Visual Graph ActiveX control on default form, set its Align = alClient, and then place database control Table1 on default form, set its Databasename = DBDemos, TableName = Employee.db.

5. Write the following code in FormShow event:

procedure TForm1.FormShow(Sender: TObject);
var
i : Integer;
sheet : ISheet;
begin
vgctrl1.Run( vgctrl1.DefaultPath + 'report.tbl' );
sheet := vgctrl1.vg.ActiveSheet;
sheet.SetPropertyValue( 'template', 'h:\template1.tbl' );
Table1.Active = true;
while not Table1.Eof do
begin
sheet.Execute( 'Append()' );
sheet.Execute( 'SetFieldValue(0,"' + Table1.FieldByName( 'Empno' ).AsString + '")' );
sheet.Execute( 'SetFieldValue(1,"' + Table1.FieldByName( 'LastName' ).AsString + '")' );
sheet.Execute( 'SetFieldValue(2,"' + Table1.FieldByName( 'FirstName' ).AsString + '")' );
sheet.Execute( 'SetFieldValue(3,"' + Table1.FieldByName( 'Hiredate' ).AsString + '")' );
sheet.Execute( 'SetFieldValue(4,"' + Table1.FieldByName( 'Salary' ).AsString + '")' );
Table1.Next;
end;
sheet.Execute( 'Build()' );
end;


The report template bin\report.tbl declares 3 functions: Append - appends a new row, SetFieldValue - sets the value for some cell at the last row, Build - generates the report data.

6. Run this program, you will get the following report:

Detail Report 3


Sitemap | Legal Notices | Privacy Policy | Contact Us | About Us
Copyright© 2004-2017 TriSun Software Inc. All rights reserved.