Click here to Skip to main content
Email Password   helpLost your password?

Screenshot

Introduction

This component helps you generate simple but useful reports for printing in .NET. The idea is to generate XML-based templates, and then to call them from your program, and eventually to fill them with the data required. This is appropriate for generating small and simple printing documents.

Background

The basic class of this project is DaPrintDocument. It inherits from the standard .NET class PrintDocument. Therefore, you can use it pretty much the same way as the PrintDocument class.

This class simply paints attached drawing objects within its PrintPage() method. For simplicity, there are only four types of drawing objects supported: TextField (simple formatted text), PictureBox (images), ChartBox (simple charts), and StyledTable (table with static or dynamically loaded data).

Template file overview

DaPrintDocument makes use of template files written in XML syntax. Those provide all static information relevant for printing a page.

You can write template files in any text editor, or alternatively, use the DaReport Designer (beta) provided in the distribution (it's a separate application: DaReportDesigner.exe).

The brief overview of the XML structure:

<daReport>

<parameters>
   <parameter name="parameter1_name" />
   <parameter name="parameter2_name" />
</parameters>

<content>

<!-- Static objects are evaluated once per report -->
<staticContent>

      <!-- The list of static objects goes here. 
         Check in reportStatic.xml (in download package). -->
     
</staticContent>

<!-- Dynamic objects are evaluated once per page of report 
      (like data table segment or page number) -->
<dynamicContent>

      <!-- The list of dynamic objects goes here. 
        Check in reportDynamic.xml (in download package). -->

</dynamicContent>

</content>
</daReport>

Once again, the preferred way for XML template file generation is by using the DaReport Designer (beta) provided in the distribution.

Using the code

First, add a reference to the daReport.dll file (provided in the distribution) to your project. If you feel like it, you can also put this component in your controls toolbar.

Second, add an instance of DaPrintDocument to your module (form); if you have previously attached it in your controls toolbar, simply drag it to your form:

private daReport.DaPrintDocument daPrintDocument = 
                         new daReport.DaPrintDocument();

At the point where you wish to print some report, set the template file and fill in the parameters (if any):

// set .xml file for printing

daPrintDocument.setXML("reportStatic.xml");

// fill in declared parameters (if any)

// (parameter names are case sensitive)

Hashtable parameters = new Hashtable();
parameters.Add("author","Predrag Dukanac");
daPrintDocument.SetParameters(parameters);

Using tables

Take a look at reportStatic.xml, reportDynamic.xml, reportCharts.xml, and the ReportTest project (all in the download package) for a deeper insight.

Latest update

The DaReport print engine has turned into a commercial product - Stampa Reports System�. A Stampa Reports demo is available for download here. Stampa designer features backward compatibility with daReport in design mode. The Stampa printing engine can be used free of charge.

The DaReport project at this address is still an open-source project by all means.

You must Sign In to use this message board.
 
 
Per page   
 FirstPrevNext
QuestionMem usage problem!!!!!!!!!!! [Report design]
utehn
0:37 9 Jan '09  
Confused When you click File > New > and Close and try like this again, memory is NOT decrease.

Please help me!!!!

Thanks!Rose
QuestionUSE FREE
Member 3233816
6:00 31 Dec '08  
FOR THE AUTHOR OF DAREPORT , askED you IF
POSSIBLE USE THE DAREPORT IN
COMMERCIAL APPLICATIONS?
THANK YOU.
Generalprinters on c#.net
balu12345
8:41 30 Jul '08  
Hi,

Iam developing an application/service for printers.The scenario is as follows

1. When a user selects a document and then he says the print command(no through my application...he selects normal print in file menu)then i have to catch some details like printername,no.of pages,document name..and so on...This action should be done before it get out from spooler.

2. As all of you that after printing data from spooler will be deleted..but in general for example for HP printer 3 files like lpr1234.tmp,shockwaveobject file ,.shd are generated. In this I have take take required files and keep them in my own spooler.

On my extensive search I came to know that by using WMI and WindowsAPI functions I can get to this goal...

But Iam unable to get into the right way....
If I have to use APIs then kindly tell what are the method I have to implement(if possible give me documentation link)

If through WMI....kindly guide me for the same

ALL these should be act as a service.....

thanks in Advance
QuestionHow can I draw text or table only at the end of last page?
JM ® - DE CASTRO
12:58 11 Jun '08  
hello, How can I draw text or table only at the end of last page?
GeneralVery nice
Hugo Faselo
12:16 13 Dec '07  
Congratulations!! is a good work. I have a question, how i do generate dynamics images in a report. I have the Physical path of each image in a table in the data base, and I want to show many images in the report. How can i do this?
Sorry for my bad English.
QuestionRe: Very nice
dimazoid
9:34 16 Oct '08  
Hello, I have the same issue...If you have already figured it out, could please let me know how, or at least point me in the right direction. Thanks a banch!

-Dave
QuestionMonday's date at the top of the report.
damonhogan
6:48 16 Nov '07  
I am doing a weekly report.

How would I go about putting the "Date for Monday" on a printed report.

I do have the "Date for Monday" in a string variable in my program.

It's not part of the table used to populate the report plus I don't want it in the output printed page in a table field.

Also I would like to put "Today's date" at the bottom as the "As of date". Is there a tag that can be used to print today's date? The page number line is perfect to place it on.

I am using a modified "reportDynamic.xml" that was provided as an example with the source code.

Thanks



Damon
Questionmultple page in staticContent [modified]
abhishek nath
21:28 5 Feb '07  
Hi,
i have face a problem that i want to print a level which content one box and inside this box some data which are varying in multiple pages. But problem is that when i want to print the data in more than one page ,the page is not increament as well as the data is increament. As a result i am see only the last entry in the print preview dialog.
please give a solution if possible. Mind it, in case of staticContent.Smile

Abhishek Nath


-- modified at 3:12 Tuesday 6th February, 2007
AnswerRe: multple page in staticContent
negleden
15:46 25 May '09  
Hi,

Maybe this thread is not important yet, but I've worked out some solution for your problem.
If you are interesting in, mail me! (negleden (at) gmail (dot) com)
GeneralWhat royalties do i need to add into the help file?
NarutoFan#1
20:50 31 Oct '06  
Hi,

I just want to know what i need to add into our help file if we want to use DaReport? Like if you use FOP you have to add the copyright...

What do i add for the DaReport? I don't see anything in the article about this.

Thank you in advance...

Regards
Nico

"Many of life's failures are people who did not realize how close they were to success when they gave up." Thomas A. Edison

GeneralRe: What royalties do i need to add into the help file?
Predrag Dukanac
0:36 1 Nov '06  
Hello.

daRepert engine (daReport.dll) is totally free to use, no matter if you use in commercial application or for testing purposes. Feel free to use it anyway you like.

Predrag Dukanac


GeneralRe: What royalties do i need to add into the help file?
NarutoFan#1
4:58 1 Nov '06  
Thank you.

I will do exactly that. Smile

Enjoy the rest of your day.

Nico

"Many of life's failures are people who did not realize how close they were to success when they gave up." Thomas A. Edison

GeneralHow to add image path?
NarutoFan#1
23:41 28 Feb '07  
Hi all. I am using daReport to create a report and i need an image on the report. I thought it would be as easy as sending the image name: "Test.jpg" as a parameter to the xml file and daReport would use that as the the image name. but no such luck as yet.


The parameter name is logopath:
<parameter name="logopath" />
i tried to use it like this...

<pictureBox x="457" y="26" width="314" height="130" strech="true"> <file>$P{logopath}</file> <border width="1" color="Transparent"></border> </pictureBox>
This then shows a blank spot where the image should be.

i used the same for a text field...(in the staticContent Section)

<textField x="601" y="206" width="100" height="23"> <text horAlignment="Left" verAlignment="Top">$P{logopath}</text> <font family="Tahoma" size="10" ></font> <foregroundColor color="Black"></foregroundColor> <backgroundColor color="Transparent"></backgroundColor> <border width="1" color="Black"></border> </textField>
This worked fine as it showed the text: "Test.jpg". How would i use this text as the image name or even an image path?

Thank you in advance.

"Many of life's failures are people who did not realize how close they were to success when they gave up." Thomas A. Edison

QuestionReportDesigner
bszom
12:38 13 Oct '06  
I can't seem to access any properties for the objects which I create?
I can add objects and drag them around on the page to position them, but there are no properties listed in the properties window... Makes it kinda hard to design anything. :P

QuestionFromPage/ToPage question
bp003
11:13 21 Jul '06  
Thanks for this great and free code !

I'm trying to use it with my own PreviewDialog, and I don't succeed to implement the PrintRange functionality, to print specified pages.

I was thinking that it could be done by setting the three properties PrintRange, FromPage and ToPage of the PrintSettings property of the DaPrintDocument, but it don't work...

Are some modifications must be done in the EventHandler of PrintPage, or others ?

Any suggestions are welcome

BP


GeneralFormatMask question
calvin_cch
16:40 3 Jun '06  
I am trying to use
FormatMask="###,#.000"
however it didnt show up the decmial place,

can I know any special settint which I have to apply ?

the datatype is
decminal, double


GeneralHow to print page numbers?
steve_dee
5:10 25 May '06  

I am using a dynamic table in amongst some other static fields above and below it. If the table contains too many rows, it prints out onto a second page, bringing with it the header and footer fields. Which is great. But, I need to put page 1 of 2 etc on the bottom now. How can this be done?

Thanks

Ste
AnswerRe: How to print page numbers?
Predrag Dukanac
5:22 25 May '06  
Create dynamic TextField with Text property set to "Page $P{pageNumber} of $P{totalPages}".


GeneralRe: How to print page numbers?
steve_dee
5:37 25 May '06  
Thanks for the speedy response. I have done that but it just prints Page 0 of 0 on both pages. Which version of daReport should I have, or doesnt it matter?

Thanks
AnswerRe: How to print page numbers?
Predrag Dukanac
21:23 25 May '06  
Download the version available on this page. Checkout the reportDynamic.xml in ReportTest subproject.
Generalnice job
clody
0:48 24 May '06  
nice you got my 5..
If you get it to the Crystal capabilities.. you are the man !

Regards,

Claudiu
QuestionMargin
calvin_cch
9:29 23 May '06  
I try to set pagesize in Letter,
and 0,0,0,0 margin,

However the print out is still shift to right, and the footer is cut.

the preview is good, but output is not same as the preview
AnswerRe: Margin
Predrag Dukanac
3:44 24 May '06  
Unfortunately,
in open source version there is a printer margin feature unsolved.

Setting printer margins somewhat depends on printer driver, so exact precision printing is not only application issue.



GeneralReport designer missing?
jmw
17:36 21 Apr '06  
I couldn't find this separate exe report designer in the zip file... any idea where I can find it?
Thanks.
GeneralDraw Text Only In the First Page
georani
5:42 21 Apr '06  
Great tool!

How can I draw text or table only at the begin of first page or at the end of last page?



Last Updated 20 Apr 2006 | Advertise | Privacy | Terms of Use | Copyright © CodeProject, 1999-2010