Search the Wiki
Forcing a Page Break
TECH TIP: Forcing a Page Break Question: “How can I force a page break occur based upon a condition calculated at run-time.” The latest versions of ReportBuilder include a TppPageBreak component which may be placed anywhere inside a report and automatically force a page break. This is the recommended method for forcing a page break Full Article…
Duplex Printing Legalese to the Back of Every Page
TECH TIP: Printing a Disclaimer on the Back of Every Page. Question: “I want to use duplexing to print some legalese on the back of every page of my report. How do I do this?” Answer: This is fairly easy to do – basically, every odd numbered page will contain data, while every even numbered Full Article…
How To…Standard Header/Footer
Question “How can I implement a standard header and footer for all of my reports? Solutions 1. When implementing form based reports, you can use Delphi’s form inheritance to create a base report layout Notes: Do not use inheritance for the DataPipelines, unless you set AutoCreateFields to False. Do not use Delphi form inheritance for Full Article…
How To…Skip First X Labels
Question “How can I skip the first X number of labels on a sheet, so that my users can reuse label sheets?” Solution The following exmple shows how to use the DetailBand.BandsPerRecord to to skip X number of labels. Download: SkipLabels.zip Download: SkipLabelsLeftToRight.zip Sample Delphi code: procedure TForm1.btnPreviewClick(Sender: TObject); begin // get number of labels Full Article…
How To…Repeat Labels
Question “How can I print X number of labels for each record?” Solution This example shows how to use the DetailBand.BandsPerRecord property to print X number of labels for each record. Download: RepeatLabels.zip Sample Delphi code: procedure TForm1.ppDetailBand1BeforePrint(Sender: TObject); var liCount: Integer; begin {check BandsPerRecordCount, it resets to 1 when all bands for the prior Full Article…
Adding Custom Labels to the Label Wizard
The ReportBuilder Label Wizard contains an extensible architecture that enables additional sets of labels to be created and registered. Creating new label sets is a very simple process. Open ppLabelDef.pas located in RBuilder\Source.This unit contains the TppLabelSet class which is the abstract ancestor class for all label sets. This class contains the necessary logic to Full Article…
Suppress Group Footer When Only One Detail
When you are calculating totals in the group footer band, it is often useful to suppress the group footer band when only one detail band exists for the group. This simplifies the format of the report, because it is unnecessary to repeat the same number twice (once in the detail band and once in the Full Article…
How To…Keep Nested Groups Together
Question “The report engine seems to become occationally confused when I try to keep nested groups together. How do I work around this?” Solution Separate your nested groups into subreports. -Main Report –Group 1 –Subreport 1 —Group 2 —Subreport 2 —-Group 3 etc… This will require you to rethink your data as you will now Full Article…
How To…Group on First Letter
Question “How do I group on the first letter of a field?” Solution The easiest way to accomplish this is to taylor your original SQL code to your grouping needs. If you add a field that only selects the first letter of another field, grouping on that field is very easy from ReportBuilder. In most Full Article…
How To…Display a Group Footer on Every Page
Question “How do I ensure that the group footer will display on every page of my report?” Solution This can be helpful if you need a page summary band, similar to the page footer band but snaps to the last detail band. Use the DetailBand.BeforePrint event to determine if the group will break before space Full Article…
How To…Detect the Last Group Detail
Question “How do I detect the last detail printed in a group?” Solution Create a separate dataset that counts the values present for each group based on the grouping field. You can then use this information to determine when the detail band has reached its final record for that group and you can make alterations Full Article…
How To…Align Group Footer to Bottom
Question “How can I align the Group Footer to the bottom of the page?” Solution The following example uses the GrouppFooter.BeforePrint event to to align a static height group footer to the bottom of the page. Download: AlignGroupFooterToBottom.zip Sample Delphi code: procedure TForm1.ppGroupFooterBand1BeforePrint(Sender: TObject); var lPageBottom: Single; begin {Get the bottom of the page from the Full Article…
How To…Write Checks Using ReportBuilder
Question “Is it possible to print pre-formatted checks using ReportBuilder?” Solution The following example uses a free Delphi library NumWords to convert numerical values into English text. This allows you to convert a dollar amount to a text string for check writing purposes. The full version of this library including other language translations is available Full Article…
How To…Print Receipts
Question “How can use ReportBuilder to print receipts to a continous roll of paper?” Solution Receipts have a unique characteristic in that they typically print on a continuous roll of paper – there is no concept of page size. For continuous printing use title/summary bands and remove the header/footer. Size the detail band to print Full Article…
Forms Emulation
Customers often ask how to include their pdf forms in ReportBuilder so they can do forms emulation like the tax form shown in one of the Developer’s Guide tutorials. The solution is convert the PDF to a metafile (WMF/EMF). A high quality metafile will contain a list of Windows GDI commands required to render the form to Full Article…
How To…Start a Left to Right Column on a New Row
Question “How can I force each group to start at the beginning of a new row when using left-to-right columns?” Solution Inside the GroupFooter.AfterGenerate event, set the TppEngine.CurrentColumn property to -1. This will force the next column printed to be the 0 (first) position. Download: StartLeftToRightColumnOnNewRow.zip Sample Delphi code: procedure TForm1.ppGroupFooterBand1AfterGenerate(Sender: TObject); begin ppReport.Engine.CurrentColumn := Full Article…
How To…Prevent an Orphaned Summary Band
Question “The summary band of my report displays alone on the last page of my report. Is there a way to move the last detail band to the next page to prevent this behavior?” Solution This can be done by measuring the amount of space the last detail plus the summary band take on the Full Article…
How To…Mix Left To Right Columns With Top To Bottom Columns
Question “Is it possible to have my master data print with left to right columns and my detail data to print top to bottom?” Solution Use multiple subreports to separate the left to right data and the top to bottom data. See the demo below for an example of how this can be done. Download: Full Article…
How To…Fille Line With Dots
Question “How can I format each line with something like ‘Value…..’ such that ‘.’ characters are used to fill the remaining space?” Solution This example shows how to Use a Variable and its OnCalc event to append the appropriate number of ‘.’to each line. Download: FillLineWithDots.zip Sample Delphi code: uses ppTypes, ppUtils; procedure TForm1.ppVariable1Calc(Sender: TObject; Full Article…
How To…Fill Space After the Last Column
Question “Once my columns have finished printing on a page, how can I fill the remaining space to the bottom of the page?” Solution Use a group footer band to fill the space. Inside the GroopFooterBand.BeforePrint event, check the remaining space on the page and resize the band to match that size. Download: FillSpaceAfterLastColumn.zip Sample Full Article…
How To…Create Header and Footer Columns
Question “How can I create a header column (to the left) and a footer column (to the right) of my column data?” Solution Use the group header and group footer bands as the header and footer columns. Place a region in each band and size them to roughly the length of the page. These will Full Article…
How To…Create Conditional Columns
Question “How can I show multiple columns in certain cases, then revert back to a single column in other cases in the same report?” Solution Use x number of child subreports to act as each column, and a single full width subreport to act as the single column. Then toggle the visibility of each subreport Full Article…
How To…Align the Group Footer for Every Column
Question “How do I line up the group footer bands when using multiple columns and the amount of records in each group is different?” Solution This can be done by copying the draw commands in the existing group footers then moving them to the proper position on the page lined up with the lowest group Full Article…
How To…Align Memo Bottoms
Question “How can I align the bottoms of two stretching memos?” Solution This example contains a report with two stretching Memos inside a Region. Region.KeepTogether is set to True. The Memo OnDrawCommandCreate event is used to obtain a reference to the DrawCommand object that is created each time the object generates on the page. The Detail Full Article…
Displaying Boolean Field Values
Formatting boolean data fields with ReportBuilder can be performed using either of the following techniques: Specify a value for the TppDBText.DisplayFormat property. Example: DBText1.DisplayFormat := ‘True;False’; Specify a value for the TField.DisplayValues property of the dataset. Example: TField1.DisplayValues := ‘Yes;No;’ Note: If you have TField.DisplayValues assigned, please do not assign DBText.DisplayFormat.
Currency Formatting
Currently when formatting currency display formats, ReportBuilder internally calls FloatToStrF with a ffCurrency paramter. This honors the Windows currency settings. There are two ways to override this behavior: Create a Descendant of TppDisplayFormat See ppDisplayFormat.pas. You can easily create a descendant of TppDisplayFormat and specify that your TmyDisplayFormat be used by ReportBuilder to perform formatting. Full Article…
How To…Change the existing display formats
Question “How do I change the current display formats provided with ReportBuilder (or add new display formats)?” Solution The built-in display formats are defined in the GetDisplayFormats routine of the TppDisplayFormat class inside the ppDisplayFormat.pas file. Descending from this class gives you the opportunity to replace these values as well as customize the way ReportBuilder Full Article…
Toolbars
The various toolbars accessible from the design workspace are documented in this section. The toolbars are dockable and follow the Office97 interface style. The Toolbars are accessible from the View | Toolbars menu option of the Report Designer or by right-clicking on the docking area at the top of the Report Designer. The Report Tree Full Article…
Subreports
In traditional banded-style report writers, reports that can be printed from a single source of data are quite easy to create. But if the content of the report consists of information from several different sources of data, the choices become quite limited. One option is to use SQL to join the data together into one Full Article…
Smart Layouts
ReportBuilder allows you to create highly dynamic report layouts. The SubReport, Memo, RichText, and Region components have the ability to expand or contract to accommodate the information they contain. There are a host of properties designed to keep your reports looking good in the variety of situations created by these dynamic components. Property Description Full Article…
Report Wizard
The Report Wizard is one of the many parts of ReportBuilder that reflects a level of professionalism and attention to detail found in no other reporting product. If you or your end-users have utilized standard Windows wizards in other products, then you will be able to quickly recognize and use the ReportBuilder Report Wizard. The Full Article…
Form Emulation
Form Emulation is the process of taking a paper-based or electronic form and rendering a likeness of it. The likeness may include formatting of the form itself, or may only contain the data which will ‘fill-out’ the form. There are two basic issues that a form emulation solution must resolve: How will the formatting of Full Article…
Drag and Drop Support
ReportBuilder contains a Report Wizard that allows you to quickly create an entire report layout. This is great for generating an entire report, but what if you need to create only a portion of a complex report? Drag and drop functionality is an ideal solution for this problem because it allows you to create a Full Article…
How To…Create a Crosstab via Code
Question “How can I create and configure a crosstab using code?” Solution The following example adds a crosstab to the detail band and defines row, column, and value dimensions. Download: CreateCrosstabViaCode.zip uses ppClass, daDataModule, ppReport, ppCTMain; procedure TForm1.CreateCrosstabInCode(aReport: TppReport); var lCrossTab: TppCrossTab; liRowDimension: Integer; liValueDimension: Integer; begin // create crosstab and place in the detail Full Article…