Chapter 3 Quick Start

Learning how to use PTReportCom

You can teach yourself how to use PTReportCom by choosing from the methods available in this section:

Sample Database

PTReportCom comes with Sample.mdb, a sample database you can use when learning the program. Sample.mdb is a Microsoft Access database. Virtually all of the examples in this manual are based on Sample.mdb data.

The sample reports access the sample database through the ODBC data source name "Report Sample". When you install PTReportCom, you can choose to add the ODBC data source name. And you also can add the ODBC data source name manually.

To create the System DSN "Report Sample", do as follows:

1. Click the Windows Start button, choose Settings, and then click Control Panel.

2. On computers running Microsoft Windows 2000 or later, double-click Administrative Tools, and then double-click Data Sources (ODBC). The ODBC Data Source Administrator dialog box appears. On computers running previous versions of Microsoft Windows, double-click 32-bit ODBC or ODBC.

3. Select the System DSN tab, and then press Add button.

4. Choose Microsoft Access Driver (*.mdb), then press Finish button.

5. In the ODBC Microsoft Access Setup dialog box, type Report Sample in the Data Source Name box.

6. Press the Select button, and browse to select Sample.mdb.

7. Press OK button to close the ODBC Microsoft Access Setup dialog box.

8. Press OK button to close the ODBC Data Source Administrator dialog box.

Samples

After PTReportCom is installed, some samples are installed too. Use these samples to learn PTReportCom.

The samples include a sample database, VB sample programs, VBA sample programs and sample reports. They are located in the Application Data\LJZsoft under All Users or your profile folder.

Directory Description
{data}\Common\SampleDatabase Contains the sample database "Sample.mdb".
{data}\PTReportCom\Samples\PPTReport Contains the report template files (.ppt) and the PTR files (.ptr).
{data}\PTReportCom\Samples\VB Contains the sample programs for VB6.0.
{data}\PTReportCom\Samples\VBA Contains the sample programs for Microsoft PowerPoint VBA.

{data} is the path of the data folder. You can select the data folder when you install PTReportCom. By default, the data folder is the Application Data\LJZsoft folder under All Users. If you install PTReportCom without administrative privileges, the data folder is the Application Data\LJZsoft folder under the current user. The data folder is usually at:

Windows 95/98: C:\windows\All Users\Application Data\LJZsoft

Windows NT: C:\WinNT\Profiles\All Users\Application Data\LJZsoft

Windows 2000/XP: C:\Documents and Settings\All Users\Application Data\LJZsoft

Windows Vista: C:\ProgramData\LJZsoft

Creating a Report Programmatically

1. Create a template

In Microsoft PowerPoint, create a report template file named "custlist.doc". Static values and any Excel features included in the template will be included in the generated report. The template file you have created as follows:

PowerPoint Report Template - Customer List

2. Write the code in your application.

    Set con = New ADODB.Connection
    Set rec = New ADODB.Recordset
    con.ConnectionString = "Data Source=Report Sample"
    con.Open
    strSQL = "SELECT CompanyName, CityName, CountryName, ContactName 
	          FROM Customers, Cities, Countries 
			  WHERE Customers.CityCode = Cities.CityCode 
			  AND Customers.CountryCode = Cities.CountryCode 
			  AND Customers.CountryCode = Countries.CountryCode 
			  ORDER BY CompanyName, CityName, CountryName"
    rec.Open strSQL, con
    ptrpt.VarTableReport Recordset:=rec, Slide:=pptSlide, Table:=1, 
		CellList:="A2", Reserve:=2, PageBreak:="12"
    rec.Close

Creating a Report with PPTReport.exe

1. Create a template

PowerPoint Report Template - Customer List

In Microsoft PowerPoint, create a report template file named "custlist.ppt". Static values and any PowerPoint features included in the template will be included in the generated report. The template file you have created as follows:

2. Create a PTR file

Create a PTR file named "custlist.ptr" using PTReportGen or a text editor. The following is the content of the PTR file.

PPTReport Version 2.0
[Data Source]
Name1=Report Sample

[File]
ReportTemplateFileName=custlist.ppt
ReportFileName=Report\custlist.ppt
LogFileName=Log\custlist.log

[SQL]
@F1=Report(slide=1 cell=A2 pagebreak=12 reserve=2)
SELECT CompanyName
,CityName
,CountryName
,ContactName
FROM Customers, Cities, Countries
WHERE Customers.CityCode = Cities.CityCode
AND Customers.CountryCode = Cities.CountryCode
AND Customers.CountryCode = Countries.CountryCode
ORDER BY CompanyName,CityName,CountryName

3. Run PPTReport.exe

pptreport c:\report\custlist.ptr