Click here to Skip to main content
15,891,780 members
Articles / Programming Languages / Visual Basic 10
Tip/Trick

Concatanate Report Pages into one Report (XtraReport)

Rate me:
Please Sign up or sign in to vote.
3.00/5 (2 votes)
5 May 2012CPOL 21.7K   1  
Adding report pages to create one report

This article appears in the Third Party Products and Tools section. Articles in this section are for the members only and must not be used to promote or advertise products in any way, shape or form. Please report any spam or advertising.

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.

VB.NET
Imports DevExpress.XtraPrinting   

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

Image 1

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

Image 2

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

Image 3

On the button click event:

VB.NET
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

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer
Sri Lanka Sri Lanka
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

 
-- There are no messages in this forum --