Using Report Manager ActiveX control

Download the Report Manager Activex component from sourceforge and unpack it to a directory usually windows system directory.

Unzip it and install it (you must have Administrator Rights)

At command line execute:

regsvr32 Reportman.ocx

Then the control is available to insert in any ActiveX application or development enviroment

In your development enviroment you usually must activate (or include into your project) to use, is called ReportManX Control or Reportman Library.

Usually you use Filename, Preview property and Visible properties at design time and Execute method at runtime.

Here is a list of properties and methods:

procedure SetDatasetSQL(datasetname:string;sqlsentence:string);
procedure SetDatabaseConnectionString(databasename:string;connectionstring:string);
function GetDatasetSQL(datasetname:string):string;
function GetDatabaseConnectionString(databasename:string):string;
procedure SetParamValue(paramname:string;paramvalue:Variant);
function GetParamValue(paramname:string):Variant;
function Execute:Boolean;
procedure ExecuteRemote(hostname:String;port:integer;user,password,aliasname,reportname:String);
procedure PrinterSetup;
function ShowParams:boolean;
procedure SaveToPDF(filename:string;compressed:boolean=false);
function PrintRange(frompage:integer;topage:integer;
procedure SetBounds(ALeft, ATop, AWidth, AHeight: Integer);override;
constructor Create(AOwner:TComponent);override;
{ Public declarations }
{ Published declarations }
property Filename:string read FFilename write SetFilename;
property Preview:boolean read FPreview write SetPreview default true;
property ShowProgress:boolean read FShowProgress write SetShowProgress;
property ShowPrintDialog:boolean read FShowPrintDialog write SetShowPrintDialog;
property Title:string read FTitle write SetTitle;
property Language:integer read FLanguage write SetLanguage;

Since version 1.5 there are this interfaces available

property Report:IReportReport;
// Inside Report
property Params:IReportParams;
// Inside Params
property Count:Integer;
property Items[index:integer]:IReportParam
// Inside param
property Value:Variant
property Name:String;
property ParamType:TxParamType
property Description:WideString;
So to Access a parameter type or Name:
Or to Get parameter count:

Since version 1.6 there are this interfaces available

procedure CalcReport(ShowProgress:Boolean);
procedure Compose(Report:IReportReport;execute:Boolean);
procedure SaveToText(const filename, textdriver: String);
procedure SaveToExcel(const filename: String); // Needs Excel installation


Since version 2.0

procedure SaveToHTML(const filename: String);

Early binding (VTables) and late binding (OleAuto) is supported

Since version 2.1

procedure SaveToCustomText(const filename: String);
procedure SaveToCSV(const filename: String);
procedure SaveToSVG(const filename: String);
procedure SetRecordSet(const datasetname: String,recordset: OleVariant);

Since version 2.3

procedure SaveToMetafile(const filename: String);
procedure SaveExcel2(const filename: String); // Save to excel in only one sheet
property DefaultPrinter:WideString; // Sets & gets the default printer for Report Manager Engine
property PrintersAvailable:WideString; // Gets a list of the available printers separated by a LF (Chr(10))
procedure GetRemoteParams(hostname:string;port:integer;user,password,aliasname,hostname:string)

Since version 2.5

procedure SaveToCSV2(const filename,separator: String);
property AsyncExecution:Boolean

A new control have been introduced: PreviewControl, to work with the classic ActiveX control, drop onto the form:

ReportManX1.FileName = "c:\test.rep"
PreviewControl1.EntirePageCount = 2
PreviewControl1.SetReport ReportManX1.Report

Since version 2.5f

The Report object inside the activeX controls have a new property

property AutoResizeColumns:Boolean

This property will force the resize of all added columns to fit inside the parent section.

To add columns to a report you can call the AddColum method

procedure AddColumn(width:integer;expression,expformat,caption,captionformat,summaryexp,summaryformat:widestring);

The expformat must be a report elementent inside the template, for example 'TRpExpression2'.

Inside params, exists a new function, FindParam that returns true if the parameter exists.

Since version 2.7c

procedure SaveToHtmlSingle(const filename: String);

Saves the report as html file, in a single html file if possible.

Using the control with VB like languages

The ActiveX control may be used directly in VB, VBScript, ASP and WSH. In the VB environment you are generally recommended to "Reference" the control from within a VB Project. This gives "early binding" which improves the performance of your application over "late binding". This is not an option within VBScript languages.

Here is an complete example of the use of control in a VBScript program. This one was developed under W/98 and runs under the Windows Scripting Host (WSH). The choice of runtime environment dictates the format of the second line of the program where the activeX object is created. For example, under Active Server Pages VBScript, this line would read

set blah = server.createobject("ReportMan.ReportManX")

(please note for ASP work you must use a version 1.3+ of the OCX). Here is the example program

dim blah
set blah = WScript.createobject("ReportMan.ReportManX")
' the object blah is an instance of the activex control
' set some environment variables 
blah.Preview = false
blah.ShowProgress = false
blah.ShowPrintDialog = false
' define the location of the report file to be generated 
blah.Filename = "C:/sample4.rep"
' generate the report 

Rather than execute (print) the report you might instead choose to generate a PDF file to be later viewed with the Adobe Acrobat Reader. To do this substitute the line "blah.execute" with

blah.SaveToPDF "hello.pdf",true

This action creates a pdf format file named "hello.pdf". For a more complete list of methods available on the control please see the table at the top of this page.

Setting report parameters from VBScript

It is possible to pass parameters to the report at run time. These parameters could, for example, change the set of data that is returned from the database and reported. The parameters are identified within the report definition and used within the SQL Select statement by preceeding the parameter name with a colon (:) character. So if a parameter named "PARAM1" was defined it may be utilised in a SQL Select statement such as:

Select * from testtable where column1 = :PARAM1

The parameter "PARAM1" is set from VB/Script by a program line such as

blah.setParamValue "PARAM1" , 442380629429

Clearly this line is best placed in your program AFTER the report file to be used has been identified. For further information on parameters please see
"Advanced Report Design/Using Report Parameters"

Obtaining information about report parameters

You can obtain information about parameters by accessing the Report property.

rp.filename = "c:\sample2.rep"
rp.Report.Params.Items(2).Value = 1920
rp.Preview = True
MessageBox.Show(Str(rp.Report.Params.Count), "Paramcount", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)

Using report Manager ActiveX from ASP pages

You can use the Report Manager ActiveX to generate the pdf inside a ASP page and return it to the current processing page on the fly. For that purpose there is a Microsoft Transaction Server Object, so you can retrieve the entire stream. You must pass the prepared report to the object. This sample will help you:

<%@ Language=VBScript %>
<% Set Reportobj = Server.CreateObject("ReportMan.ReportmanX")
ReportObj.Filename = "c:\inetpub\wwwroot\cgi-bin\nettest.rep"
Set DelphiASPObj = Server.CreateObject("ReportMan.ReportmanXAServer")
DelphiASPObj.GetPDF ReportObj.Report,false

When working in the IIS environment remember to place the reports in a directory accessible (permissions) by the user executing IIS.

Version 2.2 DelphiASPObj have this procedures:

procedure GetPDF(const Report: IReportReport; Compressed: WordBool);
procedure GetCustomText(const Report: IReportReport);
procedure GetText(const Report: IReportReport);
procedure GetCSV(const Report: IReportReport);

Version 2.3 DelphiASPObj have this new procedures:

procedure GetMetafile(const Report: IReportReport);

Version 2.5 DelphiASPObj have this new procedures:

procedure GetCSV2(const Report: IReportReport;separator:string);