Frequently Asked Questions
Q. What version do I need?
A. TExtraDevices is licensed per developer just like ReportBuilder. You will need 1 license per developer. You can then distribute your compiled applications to users without the need of a license so long as the source is not distributed.
Q. How do I install the package?
A. 1. Download EXTRADEM.EXE
2. Run EXTRADEM.EXE and select an install directory
3. Start Delphi
4. Select "Install Packages"
5. Press "Add"
6. Select xtradev.bpl in the install directory you created in step 2
Q. How do I add the devices to my project?
A. After installing the package, a new component called TExtraOptions will appear on the ReportBuilder tab. Drop one of these on your main form of your application and all reports within the entire application will be able to export to the new formats.
Note: You must set the AllowPrintToFile property of the TppReport component to True
Q. How can I tell which device the user selected in the print dialog?
A. You can check the Report.PrintDialog.DeviceType property to determine which device
the user selected. This property is available only if the print dialog is shown.
Q. How can I combine several reports into one so I can generate one file?
A. The easiest way to do this is to use subreports. The following code builds a single report
from a list of separate reports.
procedure TForm1.Button1Click(Sender: TObject);
SubList, RptList: TList;
SubList := TList.Create;
RptList := TList.Create;
RptList.Add(ppReport1); // Add your own reports here!
MasterRpt := TppReport.Create(Self);
MasterRpt.HeaderBand.Report := Nil;
MasterRpt.FooterBand.Report := Nil;
for I := 0 to RptList.Count - 1 do begin
SR := TppSubReport.Create(Self);
SR.Band := MasterRpt.DetailBand;
SR.PrintBehavior := pbSection;
SR.Report.PassSetting := psTwoPass;
SR.ResetPageNo := False;
MasterRpt.TextFileName := 'MASTER.PDF';
MasterRpt.AllowPrintToFile := True;
MasterRpt.ShowPrintDialog := True;
MasterRpt.DeviceType := 'PDFFile';
for I := 0 to SubList.Count - 1 do begin
Q. Why won't my report print to the device specified?
A. Make sure you include TXtraDev in the uses statement of any unit in your project. This allows it to register the devices at runtime.
Q. Why are my memo fields truncated in the spreadsheet devices?
A. Due to the version of spreadsheet files that the devices create, text items are limited to 255 characters. Therefore, TExtraDevices truncates all items over 255.
Q. Why are my layered items garbled in my device output?
A. TExtraDevices tries to render your report as accurately as possible given the capabilities of the output device. Certain elements like layering (one report object atop another) cannot be accurately reproduced.
Q. Where are my lines/images/RichText objects in RTF?
A. In Word, to view lines and images you must turn on preview mode under view.
Q. I get a EClassNotFound compile error when using the TExtraOptions component
A. Make sure the txtradev appears before txcomp in the uses statement of the unit.
Q. When I try to install the package I get an error that ppFilDev was compiled with a different version?
A. If you have the registered version you can simply open XDeviceN.dpk (where N is replaced with the Delphi version #) and click compile. For demo users you must obtain the same version of RB that the demo is compiled with.
Q. When I print to HTML/Graphic devices the TextFileName is not used!
A. HTML & Graphic devices create a single file for each page printed since these file formats do not allow page breaks like other formats. By default, TExtraDevices will use the path from the TextFileName property and create a sequence of files called rptxxxx.htm where xxxx will be a sequential number. If any images or shapes are in the report, corresponding files called imgxxxx.jpg will be created. If you want to use your own file name and have the sequential number added to it, set the HTML.UseTextFileName := True or Graphic.UseTextFileName := True depending on which device you are using. TExtraDevices will then create files with that base name and xxxx appended to it.
Q. How do I recompile the package?
A. Based on the version of RB that you are using, you may need to recompile the package.
Here are the steps necessary to do this:
1. All defines for additional component support and ReportBuilder versions are contained in the unit TXDEFS.PAS.
Open this unit and find the appropriate Delphi version section. Within each section are the various compiler defines available. To enable/disable each feature you will uncomment/comment the define.
The following defines are available:
$DEFINE USERB603 - Enable support for RB 6.03 and earlier
$DEFINE USERB9UP - Enable support for RB 9.x and later
$DEFINE USEWPTOOLS - Enable WPTools RichText support
$DEFINE USEGRIDPACK - Enable GridPack support
$DEFINE USERICHVIEW - Enable TRichView support
$DEFINE USEINDY10 - Enable Indy 10 support
Note: If you have RB 7.x you need to comment out the USERB603 and USERB9UP defines.
2. Open XDeviceN.dpk in the install directory of the Delphi version you are using. For example, if you have Delphi 5, open XDevice5.dpk in \DELPHI5\SOURCE
3. Remove the rbRCLxx package from the project.
5. Delphi will prompt you to add the correct RB package. Click OK.
6. Copy all files from the SOURCE directory to the LIB directory.
Note: The new BPL file may be created in the Delphi BPL directory. If it is, copy this to the LIB directory.
Q. How do I send a report to a browser using only a stream?
A. The following code will send a PDF file to a browser using only a stream:
procedure TWebModule1.WebModule1WebActionItem1Action(Sender: TObject; Request: TWebRequest;
Response: TWebResponse; var Handled: Boolean);
MS := TMemoryStream.Create;
HD := TPDFDevice.Create(Self);
HD.PrintToStream := True;
HD.ReportStream := MS;
HD.Publisher := Rpt.Publisher;
Response.ContentType := HD.ContentType;
Response.ContentStream := MS;
Q. How do I create HTML reports on a server and send the results back to a user?
A. In your web server application do the following:
1 .Set the DeviceName to HTMLFile
2. Set the TextFileName to a unique session id (i.e. serverpath\reports\xxxx.htm where xxx is replaced with a session id
3. Set the UseTextFileName property to True of the HTML device.
This will create all HTML & Images files prefixed with the content of TextFileName.
So it could be Rpt.TextFileName := 'sessionid.htm';
Then the device will create files called sessionid0001.htm, sessionid0001.jpg, etc.
4. Print the report & send it back to the browser
5. When you kill the session just delete sessionid*.* from the server.
Q. How do I remove the ReportBuilder TextFileDevice?
A. You can control which file formats are available to end users via the device class registration procedures. For example, the following code would remove the ReportTextFileDevice from the list of available file formats:
Q. My text file is empty? What Happened?
A. The TextFileDevice is a built-in ReportBuilder device and not one included with TExtraDevices. But to answer the question, you need to define which fields are exported within the Report Designer. It is under File/PrintTo File Setup. By default, all items have their save property set to false which causes the blank file.
Q. What are the file device classes included in TExtraDevices?
Q. I get an error "cannot load a package named xxxx because it contains a unit called Zlib"
A. The Delphi ZLib unit is used witihin TExtraDevices for the compression of PDF files. As a result, it is implicitily linked into the package. However, if you have any other third party products which also use the ZLib unit, you will get this error.
To get the package to load you need to recompile the package and Delphi will remove it from TExtraDevices. Follow the recompile FAQ found in this document.
Q. How do I get the end user reporting components to work with TExtraDevices?
A. The end user reporting components default AllowPrintToFile to False. This
needs to be set to True on the creation and loading of reports like this:
procedure TmyEndUserSolution.FormCreate(Sender: TObject);
// assign event-handler to template events}
ppReport1.Template.OnNew := ReportTemplateEvent;
ppReport1.Template.OnLoadEnd := ReportTemplateEvent;
procedure TmyEndUserSolution.ReportTemplateEvent(Sender: TObject);
// set default report properties
ppReport1.AllowPrintToFile := True;
Q. How do I disable printing or other options in my PDF file?
A. Within the PDF properties of the component there is a permissions property.
By changing any of these, the device will automatically encrypt the file and apply
Note: If you want the user to open the file without a password, set the OwnerPassword
property to a password of your choice and leave the UserPassword property blank.
Q. How do I use the DotMatrix device?
A. The DotMatrix device provides an easy and fast way to print to dot matrix printers.
Instead of using a slow graphics driver, the device will only send text and printer
escape commands to the specified port.
// Specify the port to print to (LPT1, COM1, etc)
// This can also be specified in the ExtraOptions component
ExtraOptions1.DotMatrix.Port := 'LPT1';
// Optionially specify the characters and lines per inch
ExtraOptions1.DotMatrix.CharsPerInch := cs10CPI;
ExtraOptions1.DotMatrix.LinesPerInch := ls6CPI;
Rpt.AllowPrintToFile := True;
Rpt.ShowPrintDialog := False;
Rpt.DeviceType := 'PrinterFile';