65.9K
CodeProject is changing. Read more.
Home

Concatanate Report Pages into one Report (XtraReport)

starIconstarIconstarIconemptyStarIconemptyStarIcon

3.00/5 (2 votes)

May 6, 2012

CPOL
viewsIcon

22045

Adding report pages to create one report

Introduction

The following piece of code will create a single Developer Express report (XtraReport), by adding the same reports as pages.

Using the Code

The following namespace is required.

Imports DevExpress.XtraPrinting   

Add XtraForm and add PrintControl,RibbonControl,RibbonStatusBar1 to the form. I have given the form as frmPrint.

Add XtraReport and design as you wish to represent. Following is what I have created.

I have added another form which contains a grid view and button.

On the button click event:

Add a XtraReport to the Designer and Create an object from it.
Dim masterreport As New xrBill

'Here i am loopign through the records on grid view
For r = 0 To gvGeneratedBills.RowCount - 1

    Dim report(r) As xrBill 'Create report object
    report(r) = New xrBill
    
    'Add report functionality here
    'Set the modifier property of reports controls to public
    'you can access report controls and passing data from the DB
    
    'Finally Create the report
    report(r).CreateDocument()
    
    'Add the created report's page to the main report
    masterreport.Pages.AddRange(report(r).Pages)
    
    'Set the page no to the continues format
    masterreport.PrintingSystem.ContinuousPageNumbering = True
    
    'Bind the main report printing system to the form's printing system
    frmPrint.PrintControl1.PrintingSystem = masterreport.PrintingSystem
    
Next

'Display the report
frmPrint.Show()
frmPrint.BringToFront() 

Points of Interest

You need to download the Developer Express for WinForm from www.devexpress.com.

History

  • May 06, 2012: Article created