Click here to Skip to main content
Click here to Skip to main content

Report Builder

By , 10 Jun 2004
 

Summary

This is a simple report builder component with the possibility of designing the report both at design and run-time and with a wide variety of candidates for the data source.

Contents

Introduction

Although printing in .NET is easier than ever before, it's still not accessible to everyone. The goal of this component is to provide an easy, direct, and customizable solution for printing the data that you normally process in a database driven application.

ReportBuilder doesn't target a specific control, like DataGrid or ComboBox, instead it's focusing on the data source that these controls use. Its architecture is based on DataView, and it receives as data source anything from which it can extract one: DataTable, DataView, DataGrid, ComboBox, ListBox and IReportSource.

The demo project presents two different ways of using this component:

  1. Automatically create reports for controls that have an automatic print support. To check this, click on the toolbar button labeled "Print Assistant". Moving the mouse over different controls you will notice that the mouse cursor changes. If it changes to Cursors.Hand (I was too lazy to make a more suggestive cursor) it means that the control has an automatic print support. Click on it and see what happens next.
  2. Create custom reports. These reports are designed by the programmer at design-time. Click on the button labeled "Print Grid" to see a custom report of the DataGrid on the form. Notice that for the first column, you can't change neither the Width nor the BackColor. This changes from column to column.

This component wasn't seriously tested. Use it on your own risk, and please send a feedback with the found bugs.

When you open the solution for the first time, you should compile it before doing anything else.

How it Works

In order to understand how this component works, you should be familiar with the printing process in .NET.

ReportBuilder is a wrapper class that contains and exposes the main fields of two specialized classes: PrintEngine and PaintEngine. PrintEngine inherits from PrintDocument and executes tasks related with the printing process, while PaintEngine is dedicated to the task of drawing the data from the DataSource on bitmaps. They communicate to each other through two interfaces: IPrintableClient and IPaginationClient.

Technically, the report is a collection of pages. A page has five constituent parts (or blocks): the Report Header, the Page Header, the Body, the Page Footer, and the Report Footer. The footers and headers are collections of print commands (Text, Picture, Date, etc.). A PrintCommand is very suitable for printing text, lines, and other simple things, and it has always the width of the page, and a limited height (in this case, 200 pixels). It is both simple and effective, but is not a good solution for representing complicated structures which can expand on more than one page in both directions. The layout for the Body (which is very similar with the DataGrid's layout) is provided by a PaintEngine.

PrintEngine

A report can have more pages and their architecture might not be the same (only the first page has a Report Header and only the last one has a Report Footer, etc.). That is why PrintEngine needs a PaginationEngine to provide the layout for every page in the report.

Once initialized, the PaginationEngine creates a collection of pages with complete details of how every page should be constructed. After that, the PrintEngine iterates through the page collection of the PaginationEngine requiring from all constituent blocks of each page (headers, footers, and the body) to give a bitmap with their graphical representation (picture) and then simply paints them on the page, one under the other. For this, every block must be able to say its height and provide a bitmap with the correct size.

For the headers and footers, the technique is the same, and they are all of PrintElement type. For the body, the bitmap is provided by a PaintEngine.

PaintEngine

Since printing the body of the report was too complicated to be done with print commands, a special class was totally dedicated to this task: PaintEngine. Having as input a data source and a table style, this class is able to make a virtual image of the data very similar with a layout of a DataGrid. But in most of the cases, this would be too big to fit on a page. So, it has a third input parameter, a rectangle, which represents the desired part from the big picture. The output, as you probably figured it out, is a bitmap. The cells area (GetGridBitmap) is delivered separately from the columns header area (GetColumnsHeaderBitmap). These two functions are required by the IPrintableClient interface. This interface inherits from another one: IPaginationClient. The last interface ensures that the implementer (PaintEngine in this case) is able to return its virtual rectangle (imagine that you stretch a DataGrid till it needs no more scroll bars, and all data is visible; this is the virtual rectangle) (ClientVirtualRectangle), and that it is able to return the biggest rectangle with contiguous data (no chopped columns or rows) that is included in the required rectangle (GetPageRectangle).

PaginationEngine

Having as input an IPaginationClient, headers and footers of the report, and the page rectangle, this class creates a collection of Page objects. A Page object is meant to map a real page from the report. It contains all the information needed by the PrintEngine to construct the pages of the report: the row and the column of the page in the page array (the report may expand on both directions), two boolean fields to indicate if the page contains any report header or footer, and the rectangle for the body of the page.

PrintElement

PrintElement (Report Header, Report Footer, etc.) class is a collection of PrintCommand (TextCommand, PictureCommand, BlankLineCommand, etc.) which can be graphically edited at design and run-time using a special collection editor PrintElementCollEdit. A PrintElement calculates its height by summing the height of its constituent print commands, and creates its bitmap by iterating through the commands and asking them to paint by themselves one after the other, on a drawing surface provided by it (a bitmap).

PrintCommand

Print commands are the building units of headers and footers. By default, there are six simple print commands already created: BlankLineCommand, ColumnsHeaderCommand, DateCommand, HRuleCommand, PictureCommand, TextCommand. Although these might be enough for most cases, you want to add your own print command.

How to create your own print command

HRuleCommand will serve as an example. You can find its implementation in CustomControls Project, Printing.cs file.

1. Any print command must inherit from PrintCommand abstract class.

public class HRuleCommand:PrintCommand
{// class body}

PrintCommand class does two things:

  1. Declare two abstract functions GetHeight and Draw needed by the PrintElement class to measure and draw itself.
  2. Inherit from DynamicTypeDescriptor, and override GetLocalizedName and GetLocalizedDescription members in order to provide localization support for the command properties at run-time. PropertyCommands and CategoryCommands collections will not appear in PropertyGrid at design time, and they will always be empty since I considered that there is no need to make use of property control for print commands. See Unleash PropertyGrid with Dynamic Properties and Globalization for more information on DynamicTypeDescriptor.
    • Override and implement the two abstract functions GetHeight and Draw.
      public override int GetHeight(Graphics g, PrintEngine pe, int maxWidth)
      {
        return Width;
      }
      
      public override int Draw(Graphics g,PrintEngine pe,
        Point startPoint, int maxWidth)
      {
      int yOffset=Width/2;
        using(Pen pen= new Pen(Color,Width))
        {
        pen.DashStyle=DashStyle;
        g.DrawLine(pen,new Point(startPoint.X ,startPoint.Y + yOffset),
        new Point(startPoint.X + maxWidth, startPoint.Y + yOffset));
        }
      return Width;
      }

      At this point, you are able to use your command in code, but you won't be able to benefit from the advantages of using the special editor at design or run time. For that, there are some more steps to follow. If you are not familiarized with the techniques used to edit collections with CollectionEditor, then take a look at this article: How to Edit and Persist Collections with CollectionEditor.

    • Create a TypeConverter for your class.
      internal class HRule_Converter:ExpandableObjectConverter
      {
      public override bool CanConvertTo(ITypeDescriptorContext context, 
        Type destType) 
      {
        if (destType == typeof(InstanceDescriptor)) 
        {
          return true;
        }
      return base.CanConvertTo(context, destType);
      } 
      
      
      public override object ConvertTo(ITypeDescriptorContext context,
        CultureInfo info,object value,Type destType )
      {
        if (destType == typeof(InstanceDescriptor)) 
        {
          return new InstanceDescriptor(typeof(
             HRuleCommand).GetConstructor(new Type[]
             {typeof(int), typeof(Color), typeof(DashStyle)}), 
             new object[] 
             {((HRuleCommand)value).Width,((HRuleCommand)value).Color,
             ((HRuleCommand)value).DashStyle},true);}
          return base.ConvertTo(context,info,value,destType);
        }
      }
    • Associate the newly created TypeConverter to your PrintCommand class.
      [TypeConverter(typeof(HRule_Converter))]
      public class HRuleCommand:PrintCommand
      {// class body}
    • Integrate your PrintCommand in the PrintElement's editor.

      ReportBuilder uses a special collection editor PrintElementCollEditForm to edit the print commands of the headers and footers at design and run time. It is implemented in CustomControls Project, Printing.cs file.

      In order to be available from the drop down list of the Add button of the editor, you have to add the type of your class to the available types array:

      protected override Type[] CreateNewItemTypes(IList coll)
      {
        return new Type[]{typeof(HRuleCommand),typeof(BlankLineCommand),
              typeof(TextCommand), typeof(DateCommand),typeof(PictureCommand), 
              typeof(ColumnsHeaderCommand)};
      }

      In SetProperties method, set the desired look.

      protected override void SetProperties(TItem titem, 
        object reffObject)
      {
        base.SetProperties (titem, reffObject);
        if(reffObject is HRuleCommand )
        {
        titem.Text="Horizontal Rule";
        titem.ForeColor=Color.Gray;
        titem.ImageIndex=2;
        titem.SelectedImageIndex=2;
        }
      }

      As you can see, it is possible to associate an image index for the command. The editor has an ImageList property. In the constructor, I assigned a static ImageList found in the ImageRes class.

      public PrintElementCollEditForm()
      {
        this.ImageList=
          CustomControls.BaseClasses.ImageRes.ImageList;
      }

      This image list is taking its images from a ImageListStreamer ("ImageStream"), located in ImageRes.resx resource file. To change the images for this image list, on a form, add an ImageList, add the images that you want, go to the resource file of the form, find the place where it has serialized the "ImageSteam" property of your ImageList, and copy the block between <value> and </value> tags. After that, go to the ImageRes.resx file and replace the block between <value> and </value> tags of the "ImageSteam" element with the block that you copied from your ImageList.

    How to Use it

    Automatic Print Support

    When starting a big project, it is always a good idea to leave behind some open doors. One thing that could significantly influence the flexibility of the project's structure is creating a private library for it and subclassing all the .NET standard controls that you will use in your project.

    public class PToolBar:ToolBar{}
    public class PButton:Button{}

    Never use directly a standard control, use only the controls from your library.

    • This is based on the assumption that sooner or later, you will need to change some controls, to add a new property, event etc., or simply to modify its behavior. (In the middle of the project, your boss want to have themes support, or want a better looking menu.) You modify the control in only one place, and the changes will automatically propagate all throughout the project.
    • It can be very helpful to signal at design time simple problems that otherwise will propagate to run-time and will be much harder to detect. Think of a missing ValueMember of a ComboBox, a DataGrid without a TableStyle, missing format string, etc. How to catch these errors anyway? You have here an example in PComboBoxDesigner which draws an outline around the PComboBox at design time if this has an empty ValueMember.

    Following the above idea, the ReportBuilder project has a private library with derived controls implemented in ProjectLibrary.cs file.

    Think of big data-based applications with dozens of forms, each form with many data controls as DataGrid, ComboBox, ListBox, etc. The client suddenly wants some printing capabilities for some data controls, especially the DataGrid. Normally ,you will have to modify all the existent forms, and for every data control to add and customize a ReportBuilder component. Having a private library will give you the possibility to create an automatic print support for your project. In the ReportBuilder project, it is implemented like this: on the form, there is a Toolbar which among other standard buttons has one dedicated to printing, labeled "Print Assistant". Clicking on this button will start a tracking mechanism that checks every control the mouse hovers for being "printable" (implements IPrintable interface). If it is, the mouse cursor changes to Cursors.Hand, and if clicked, disables tracking and displays the PrintSettingsDialog. Otherwise changes to Cursors.No. If the user still clicks, the cursor is reset and the tracking is stopped. This can be divided in two: create an interface (IPrintable) and implement it in all controls for which we want printing support, and create the tracking mechanism on the Form.

    IPrintable interface has three members:

    • A function GetSource that returns a DataView object, required by the ReportBuilder for the DataSource.
    • A function GetTableStyle that return a CustomControls.ApplicationBlocks.TableStyle object, required by the ReportBuilder for the TableStyle.
    • A boolean property IsValid indicating if the data source and the table style are valid, required by the tracking mechanism.

    The implementation of this interface by the PDataGrid, PListBox and PComboBox controls is straightforward and does not need more explanations.

    The tracking mechanism is implemented in totality by the PForm class. This implements the IMessageFilter interface, and listens for the WM_MOUSEMOVE and WM_LBUTTONDOWN messages. Has a protected StartTracking member which can be called from the derived classes. It is not mandatory to use the Toolbar button to start tracking, just call this procedure.

    Custom Printing

    Basically, custom printing means to assign a ReportBuilder component for each data source you want to print. This implies more work, but gives you much more possibilities to customize the output. You have here an example that uses a ReportBuilder component (rp) and a Button (btn_PrintGrid).

    As said before, this component doesn't print the control but its data source. ReportBuilder was created to print DataView objects. Since with this type of printing you will normally use the TableStyleEditor to create a TableStyle, you will need the DataSource property to be set first. To set a DataSource is very simple. Just click the drop down button of the DataSource property and a list with the available sources on the form will be displayed. In order to appear on that list, an object should be one of the fallowing: DataSet, DataTable, DataView, DataGrid, ComboBox, ListBox or implement the IReportSource interface. Be aware that when you change the DataSource property, the ColumnStyles collection of the TableStyle might be erased if the new value targets a different table.

    After the DataSource is set, you can easily create a TableStyle for the body of the report. For this, click on the ellipsis button of the TableStyle property and the TableStyleEditor will popup. This is very similar with the DataGridTableStyle's collection editor, so it should be easy to understand how it works. You can add the columns that you want, but be aware that the user is able to choose for printing only from the columns you provide. Even if a column is added to the ColumnStyles collection, it is visible only if the Visible property is set to true and has a valid MappingName. The user can toggle a column's visibility at run-time by setting the Visible property.

    You may notice that both TableStyle and ColumnStyles has two strange properties under the PropertyControl category: PropertyCommands and CategoryCommands. These collections are used for properties control, and allow the programmer to set at design-time the visibility and read only state at run-time for the properties of the parent class. For example, the programmer decides that the first column should be always visible with a fixed width and with a certain BackColor. When you create a TableStyle or ColumnStyles, the two collections are empty, and they are filled only after you compile the project. See Unleash PropertyGrid with Dynamic Properties and Globalization for more information on this topic.

    Most of the time, you will want to save as much ink as possible and to keep the report simple using only black and white. For this, the TableStyleEditor has a drop down button with two common formatting options.

    You can further customize your report by designing the headers and footers. You have a header and a footer for the report, and for the page as well. Designing these is very simple, because you have a special collection editor to assist you: PrintElementCollEdit. You can actually see the element's (header or footer) look while you are building it. If on the bottom of the element's picture, a dotted red line and scissors appeared, this means the current window in which the element is displayed is too small to contain it. If this appears on the report while you are viewing or printing it, it means that the element is higher than the space allocated for it (which is maximum 400 pixels height for the ReportHeader and 200 pixels height for the others, and has always the same width as the page), and you have to redesign the element.

    Globalization

    Globalization is a serious issue for every big application. Unfortunately, it is not always simple to implement this. To help you integrate this component in an globalized application, ProjectBuilder has its own implementation for the globalization feature. For it, the globalization problem appears only for the two editors: PrintElementCollEdit and TableStyleEditor. They can be fully localized (even the properties names and descriptions from PropertyGrid). The implementation of globalization is based on a specialized class: Dictionary found in the CustomControls.Globalization namespace. It has a simple mechanism that looks for the localized resource in a resx file called Dictionary.resx in the executable's directory. It chooses the localization language automatically based on the System.Globalization.CultureInfo.CurrentCulture value. But you can force a certain language (in this case Romanian) like this:

    System.Threading.Thread.CurrentThread.CurrentCulture= 
      new System.Globalization.CultureInfo("ro-RO");

    The names of the resources in the Dictionary.resx file must be of a certain format. To create a valid resource name, to the neutral text value, you have to append the two letter ISO name of the culture and "_". For example, to localize the text of the OK button in Romanian, you have to create a resource with this name: RO_OK. Of course, the value of the resource is at your choice. The same for the display value of a property in the PropertyGrid (for the BackColor property, create a resource with this name: RO_BackColor). With the description of a property, it is slightly different. Because of the previous format, you have to add "_Descr" at the end of the resource name: RO_BackColor_Descr. To eliminate all doubts and to see how it works, take a look at the Dictionary.resx file for some example.

    Page Numbering

    For this, you have to introduce certain tokens in a TextCommand. Here are all the available tokens:

    1. [PgNum] Represents the current page number.
    2. [PgCol] Represents the column of the current page in the two dimensional page array.
    3. [PgRow] Represents the row of the current page in the two dimensional page array.
    4. [PgNumArr] Represents the two-dimensional position of the current page in the two dimensional page array.
    5. [TotalPgs] Represents the total number of pages.

    Something like "Page number [PgNum]" will have this output on the second page: "Page number 2", and this: "Page number 3" on the third page.

    Conclusions

    This is far from being ready, and there are many parts that should be improved. This is not a final product, it is just something to get you started. I've written this article hoping that you will find it helpful, and that you will send some constructive feedback.

    References

    Revision History

    • Original article.
    • The spectrum of the DataSource property was greatly enlarged to directly accept some common controls.

    License

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

    About the Author

    Daniel Zaharia
    Web Developer
    Romania Romania
    Member
    No Biography provided

    Sign Up to vote   Poor Excellent
    Add a reason or comment to your vote: x
    Votes of 3 or less require a comment

    Comments and Discussions

     
    You must Sign In to use this message board.
    Search this forum  
        Spacing  Noise  Layout  Per page   
    QuestionVS 2010membershankarBose19 Feb '12 - 19:23 
    Anybody have the vs2010 version ?
    It has name conflict in vs 2010.
    GeneralExcellent Articlememberstephenmc00724 Sep '09 - 15:29 
    Firstly I'd like to say thank you for sharing your excellent report tool with us.
     
    I would very much appreciate if you could send me a copy of the 2005 version. I have managed to convert to 2005 and compile the code, but I cant view some of the forms in the design window.
     
    Thank you
    Email: baldymchugh@yahoo.com
    GeneralThank you!membertarvataha11 Aug '09 - 3:25 
    First of all, let me thank you for your wonderful project.
    I really wished to see a project like this, also, I hope that you could send me
    the last version of Report Builder because I am also tired of Crystal Reports.
     
    My Email is : tarigtahasabir@yahoo.com
     
    Thank you again!
    QuestionHow can i preview report in a printPreviewControl ?memberyincekara16 May '09 - 1:29 
    I want to display generated report in a printPreviewControl and still want to handle PrintPage, BeginPrint, EndPrint events. How can i implement this feature?
    GeneralReport Buildermemberduongkha28 Dec '07 - 8:46 
    HI Daniel
    I am very interested in your report builder.
    I just research a bit on your control,I have some questions:
    - Does it support to print master-details form in .NET?
    - Can we customize the report ( size, position of objects,...)?
    thanks,
    Kha.
    QuestionVS2005 Versionmembernebipinar25 Dec '07 - 0:08 
    Hi Daniel,
    Could you send me VS2005 Version of this code
    my mail adres : nebipinar(at)yahoo(dot)com
    Thanks.
    Questionproblem in vs2005memberahorar21 Apr '07 - 8:15 
    hi daniel
    ur program is very useful and very good
    thank u
    i have a problem
    when i try to compile it i got so many compile error in vs2005
    its about column style and other could u please send me C#2005 version ?
    thanks a lot
     
    my email is ahora_r@yahoo.com
    Questionwrap textmemberbogdandaniela25 Mar '07 - 20:44 
    Hello,
     
    my name is Daniela Bogdan.
    I would like to thank you for this tool.
     
    I also have a question: is it possible to configure the wrap text into a cell?
    I have problems with long texts... they are not entirely presented.
     
    Thanks.

    GeneralLast versionmemberasucarrats17 Nov '06 - 23:49 
    Hi, I'm very interesting in your last version of Report Builder (I've read the threads! Big Grin | :-D )
     
    I would like to ask you the last version if you can send me.
     
    I'm tired of Crystal Reports and your article may solve my headaches! D'Oh! | :doh:
     
    Thanks in advance,
    Agustí

    GeneralRe: Last versionmemberDaniel Zaharia19 Nov '06 - 7:25 
    I think i found it, but first you should give me your email.. Big Grin | :-D
    GeneralRe: Last versionmemberasucarrats19 Nov '06 - 9:43 
    ok, sorry
     
    you can use asucarrats@gmail.com
     
    thanks in advance! and thanks to respond so quick!
    GeneralRe: Last versionmemberMCAST7613 May '07 - 17:47 
    Hi!
     
    Can you send me the last version of Report Builder!
    That's a very interesting way to generate reports!...
     
    Thank you!
     
    My email: mcast@netcabo.pt
     
    Miguel Castanheira
    GeneralRe: Last versionmemberR. Steele6 Jul '07 - 13:53 
    Daniel,
     
    I've found Report Builder to be both useful and insightful. I'd also like to receive an updated version. My email is rsteele@1stlink.net.
     
    If you'd like, I'd be willing to contribute a download site for others that may desire updated source.
     
    Thanks in advance,
     
    rsteele

    GeneralRe: Last versionmembergetnanda@gmail.com30 Aug '07 - 0:46 
    I have read your Report Builder and I found it very impressive since I find crystal report to be very difficult to insert the objects at runtime.If you wish to send your Last version of Report Builder to me ,Please mail to getnanda@gmail.com.
     

     

     
    Thanks in advance,
    Nanda Kumar
    GeneralRe: Last versionmemberXChronos4 Nov '08 - 5:17 
    Very interesting!!!
    Great work!
    I'm also tired of Crystal Reports, please send me the last version:
    marianoluzza[at]gmail.com
    GeneralRe: Last versionmemberfatr22 Nov '07 - 2:22 
    Hi, I'm also very interestied in fresh version of Report Builder, fresh atleast to work good with Framework 2.0
     
    I would like to ask you the last version if you can send me.
     
    my email is damagedcopy(at)gmail[dot]com
     
    Thanks in advance,
    fatr
    GeneralCheck this out! http://www.neodatatype.net/memberCatalin Hatmanu6 Oct '06 - 6:03 
    http://www.neodatatype.net/
     

    Generalhi, source codemembershon97 May '06 - 10:20 
    I have read at the threads, that you were so nice and sent regenerated code files to one guy.
    I would ask for a favor, if you can send it to me too, I know it's a while, but just checked this article, by the way, it's great Smile | :)
     
    my email: bytewiz9@hotmail.com
     
    bytewiz9
    Generalprint assistant buttonmemberBilly_The_Kid3 May '06 - 4:07 
    I converted the source code to C# 2005.
    Click on print assistant button doesn't shown controls to be tracked.
    What's going wrong ???
     

     
    Billy_The_Kid.
    QuestionFree Form Data PlacementmemberReanalyse7 Nov '05 - 14:35 
    Daniel- this looks a marvelous tool
     
    Quick question- in case somebody else has already done what I need.
    Is it possible to use free form text placing in the details section and use delimiters to show the data fields
     
    For example :
    ________________________________________________________________________________
    Date Invoice raised : [datinv]
    Date Payment Expected : [datepay]
    Suggested update path : [next steps ]
    ________________________________________________________________________________
     
    Thanks
     
    -- modified at 20:35 Monday 7th November, 2005
    QuestionDatagrid ?member| Muhammad Waqas Butt |12 Oct '05 - 23:00 
    Hi,
     
    Could you please tell me where you write the code for datagrid control printing and it's data. And what change do required to add wrap text feature in it.
    Like
     
    Column 1 Column2
    --------------------------
    Column no 1 Column no 1
    line 2
    Column no 1 Column no 1
    Column no 1 Column no 1
    line 2
    Column no 1 Column no 1
    line 2
    ---------------------------
     
    Thanks in advance.
     
    |Muhamad Waqas Butt|
    waqasb4all@yahoo.com
    www.sktech.freewebspace.com
    GeneralNew Problems .memberWaqasButt8 Aug '05 - 4:35 
    Hi Daniel Zaharia ,
     
    It's Waqas again.
    [1]Can we make report without give datagrid or any other type of data or array. I mean in you current control if we never bind any datagrid like control the other report lables or control did not appear. Please tell how we show other control without binging of grid, listview, tree control?
     
    [2]I had used you code of Report Builder which you send me Wed, 9 Feb 2005 through email danielzaharia_y@yahoo.com. Now i have face some problem with the grid column length i mean can it possiable that if text of any column biger then the length of column it automatically divid into second line like this:
     
    Colunm1 Colunm1 Colunm1
    ----------------------------------------------------
    1 dasdasdasdasasdsadsd dasdasdsadsa
    2 dasdasdasdasasdsadsd dasdasdsadsa
    dsadasdsadsadsadsdds
    3 dasdasdasdasasdsadsd dasdasdsadsa
    dsadasdsadsadsadsdds
    -----------------------------------------------------
     

    Also how can i marge two tables in single report.
     
    Please tell me and if it is possible me email me.
     
    I'm waiting for you response.
     
    Muhammad Waqas Butt
    waqasb4all@yahoo.com

    QuestionReport C#.Net Grid?memberWaqasButt21 Jul '05 - 0:49 
    Hi Daniel Zaharia ,
     
    It's Waqas again.
     
    I had used you code of Report Builder which you send me Wed, 9 Feb 2005 through email danielzaharia_y@yahoo.com. Now i have face some problem with the grid column length i mean can it possiable that if text of any column biger then the length of column it automatically divid into second line like this:
     
    Colunm1 Colunm1 Colunm1
    ----------------------------------------------------
    1 dasdasdasdasasdsadsd dasdasdsadsa
    2 dasdasdasdasasdsadsd dasdasdsadsa
    dsadasdsadsadsadsdds
    3 dasdasdasdasasdsadsd dasdasdsadsa
    dsadasdsadsadsadsdds
    -----------------------------------------------------
     

    Also how can i marge two tables in single report.
     
    Please tell me and if it is possible me email me.
     
    I'm waiting for you response.
     
    Muhammad Waqas Butt
    waqasb4all@yahoo.com

    GeneralScalingmembermasontwo1 Apr '05 - 6:04 

    Daniel,
     
    Kudos on such a great tool. I am wondering if there is anyway to Scale your report so that it can fit on say 2 pages wide and 3 pages tall or to scale by a percentage?
     
    Any examles or replys are very much appreciative
     
    Thanks Justin
    GeneralAdjusting row heightmemberrforRajesh23 Feb '05 - 1:34 
    Hi Everyone,
    First of all, kudos to Daniel on developing such a wonderful component.
    Right now, it is not possible to have different height for different rows. We can only set a constant row height.
    Could someone help me in achieving that?

     
    Cheers,
    Rajesh
    QuestionGlobalization - what about complex Properties?memberkrzychub23 Feb '05 - 1:29 
    Hi Daniel.
     
    My name is Krzysztof. I am from Poland. I've got 2 questions to You.

    1. How Can I localize every occurence of some Property Name?
    (even in complex Properties such as Size or Picture)

    2. How Can I localize values such as 'Right, Top, Left etc or even color names, returned
    by standard TypeConverters/UITypeEditors?

    If there isn't a lot of work to modify DynamicTypeDescriptor, Can You send me a piece of code?
    Or if there is, Can You give me some advice How Can I do it by myself?

    Thanks.
    Krzysztof

    PS.
    Sorry for my English.
    GeneralAbout This ArticlememberWaqasButt27 Jan '05 - 22:09 
    How could we create this kind of report
     

    Exp:
     
    Paga Title1 Paga Title2
     
    Report Header1 Report Header2
     
    Label1 Label2
     
    Label1 Label2
     
    Label1 Label2
     
    Data Grid
    Report Footer1 Report Footer2
     
    Label1 Label2
     
    Page Footer1 PageFooter2
    Label1 Label2
    Label1 Label2
     
    In you code when i add new label or date it add next line if you just do this that controls can add in single line with differet positions...
     
    Please If you know help me....
    GeneralDll ErrormemberWaqasButt25 Jan '05 - 19:05 
    Hi When i complie your source again than a dll error occure
    PaintEngine missing please tell me how i do this...
    GeneralReport Builder Help (C#.Net)memberWaqasButt12 Dec '04 - 10:54 
    Hi ,
     
    My name is Muhammad Waqas Butt. I am newly member of code project web site and also new in C#.net. I have read your article last day and I try your project. I was very nice but if you include some more functions like multi columns example
     
    // Example
     
    Report Title1 Report Title2
     
    Page Title1 Page Title2
     
    Datagrid Control
     
    Footer Title1 Footer Title2

     
    All title are two on same location but alignments are change mean report title1 align left and report title2 align right like that.
     
    The benefit which I think to do so you are able to use page or report better way, better way to use page space and more controls can take place on page. If you able you can do this so you control goes more more better and best. Simply saying I like you control very much competitively from other you dll is easy to use you customization are excellent. So please if you do this think that give so much help me and people like that me which are not better in C#.net.
    [2] - How to take two tables in a single report.
    Waiting for your response Butt…
     

    Muhammad Waqas Butt
    waqasb4all@yahoo.com

     
    Muhammad Waqas butt
    GeneralRe: Report Builder Help (C#.Net)sussAnonymous18 Dec '04 - 9:51 
    HI Muhammad,
    Sorry for responding so late...
    It is possible; I’ll try to make a sample as soon as possible.
    Thanks for your interest,
    Daniel.

    GeneralRe: Report Builder Help (C#.Net)memberWaqasButt19 Dec '04 - 5:59 
    Hi Daniel,
     
    If you do this for me sooon so i shell be very thankful to you.
    And Please also send me the code in which we can join two tables in single report. Please.
    I am waiting for you response sooon...
     
    Muhammad Waqas Butt
    waqasb4all@yahoo.comSmile | :)
    GeneralRe: Report Builder Help (C#.Net)memberWaqasButt31 Dec '04 - 21:55 
    Hi ,
     
    My name is Muhammad Waqas Butt. I am newly member of code project web site and also new in C#.net. I have read your article last day and I try your project. I was very nice but if you include some more functions like multi columns example
     
    // Example
     
    Report Title1 Report Title2
     
    Page Title1 Page Title2
     
    Datagrid Control
     
    Footer Title1 Footer Title2
     

    All title are two on same location but alignments are change mean report title1 align left and report title2 align right like that.
     
    The benefit which I think to do so you are able to use page or report better way, better way to use page space and more controls can take place on page. If you able you can do this so you control goes more more better and best. Simply saying I like you control very much competitively from other you dll is easy to use you customization are excellent. So please if you do this think that give so much help me and people like that me which are not better in C#.net.
    [2] - How to take two tables in a single report.
    Waiting for your response…
     
    Please Give Quick Response.....
    Muhammad Waqas Butt
    waqasb4all@yahoo.com
     

    Muhammad Waqas butt

    GeneralRe: Report Builder Help (C#.Net)memberWaqasButt18 Jan '05 - 22:07 
    Hi ,
     
    My name is Muhammad Waqas Butt. I am newly member of code project web site and also new in C#.net. I have read your article last day and I try your project. I was very nice but if you include some more functions like multi columns example
     
    // Example
     
    Report Title1 Report Title2
     
    Page Title1 Page Title2
     
    Datagrid Control
     
    Footer Title1 Footer Title2
     

    All title are two on same location but alignments are change mean report title1 align left and report title2 align right like that.
     
    The benefit which I think to do so you are able to use page or report better way, better way to use page space and more controls can take place on page. If you able you can do this so you control goes more more better and best. Simply saying I like you control very much competitively from other you dll is easy to use you customization are excellent. So please if you do this think that give so much help me and people like that me which are not better in C#.net.
    [2] - How to take two tables in a single report.
    Waiting for your response…
     
    Please Give Quick Response.....
    Muhammad Waqas Butt
    waqasb4all@yahoo.com
     


    GeneralRe: Report Builder Help (C#.Net)memberDaniel Zaharia1 Feb '05 - 23:01 
    Hi,
    Sorry for the delay.. I’ve been very busy these months..
    Anyway, I have made you some classes that do what you want.
    Now I realize that they are too big to be posted here, so I’ll send you an email with all the library.
    Daniel.

    GeneralRe: Report Builder Help (C#.Net)sussAnonymous6 Feb '05 - 21:46 

    Hi Daniel
     
    First of all thanks for your reply and your help. I really want to do
     
    this i myself try to do this but i can’t so that’s why i ask you to how
     
    can i do this (Text Alignment). Anyways i am waiting for your e-mail
     
    please send the complete source code so i can see where i do wrong.
     
    Please send me as soon as possible. In the end i again want to thank
     
    you for you kind help…
     
    [ Muhammad Waqas Butt ]
    waqasb4all@yahoo.com
    waqasca2000@yahoo.ca

    GeneralRe: Report Builder Help (C#.Net)memberDaniel Zaharia11 Feb '05 - 0:00 
    I've sent you 3 mails. Did you receive anything?
    QuestionWhy does I get a smoothed print?memberneodatatype20 Nov '04 - 23:35 
    Hi!
     
    When I do the preview I get a "smoothed" print.
     
    Why does I cannot get a clear text grid?
     
    Thanks Smile | :)
    AnswerRe: Why does I get a smoothed print?memberxyzzer7 Feb '05 - 0:28 
    Looks like it produces bitmap output. Looks like something I could use, but I would try to replace bitmap classes with EMF ones, to get true type and vector graphics instead of that pixel hell. :]
    I didn't look into the sources yet though.
    QuestionReport Generation Help?memberWaqasButt17 Oct '04 - 4:35 
    Hi...,
     
    How to make printable report from windows form in c#. Like if a enduser select
     
    starting date and ending date so a report generated like this stlye:
     

    Report Heading
    ______________
     
    Student Name (Seleted from Winform)
     
    Period 1/10/2004 to 17/10/2004
    ------------------------------
     
    [DataGrid Values from DataBase on the bases of query]
     
    Date Title Fee Fine
    ---- ----- --- ---
    99/99/9999 | October Month Fee | 1331 | 100
    99/99/9999 | October Month Fee | 1331 | 100
    99/99/9999 | October Month Fee | 1331 | 100
    99/99/9999 | October Month Fee | 1331 | 100

    _______________________________
    Total: 224545 666444
    _______________________________

     
    Close: 325651
    __________________________________________________________
    Date Page No 1 of 4
    Report End Heading
     
    If some one know so please email me at: waqasb4all@yahoo.comEek! | :eek:
     
    Muhammad Waqas Butt
    GeneralSave Report to filememberjerrycsk18 Sep '04 - 21:12 
    Hi, Daniel
     
    My name is Jerry
     
    Can You send me an example How can I serialize and deserialize the ReportBuilder component and if it possible the version of component with modifications You've made.
     
    Thanks.

     
    C#
    QuestionTwo or more Data Tables on single Report?memberkrzychub7 Sep '04 - 23:29 
    Hi, Daniel
    I think You've done a great job with ReportBuilder however I have 2 questions:
    1. Can You send me an example How can I serialize and deserialize the ReportBuilder component
    (You've sent it to 'mrroot' before) and if it possible the version of component with modifications You've made.
    2. How Can I place 2 Data Tables (or more) on single report? Maybe there is a way to join two independent reports into one?
     
    Thanks.
    AnswerRe: Two or more Data Tables on single Report?memberkrzychub8 Sep '04 - 3:44 
    Hi, Daniel
    Ad1. Thanks for an example.
    Ad2. I've got 2 Data Tables (ie. "Orders" and "Authors").
    I need place them both on one report, but one by one.
    Is it possible?
     
    Thanks.
    GeneralRe: Two or more Data Tables on single Report?memberDaniel Zaharia8 Sep '04 - 3:47 
    no..
    Frown | :(
    GeneralRe: Two or more Data Tables on single Report?memberkrzychub8 Sep '04 - 6:53 
    I don't know if You got my last message, so I will rewrite it.
     
    In example, You sent me 'Serialize' Button doesn't work:
     
    private void button1_Click(object sender, System.EventArgs e)
    {
    System.Threading.Thread.CurrentThread.CurrentCulture= new System.Globalization.CultureInfo("ro-RO");

    }
     
    Can You send me another example?
     
    And the last question:
    How Can I localize the value of Property?
    (i.e. 'Left' -> 'Lewe' it's Polish)
     
    Thanks again.
    GeneralRe: Two or more Data Tables on single Report?memberDaniel Zaharia8 Sep '04 - 20:49 
    my mistake!D'Oh! | :doh:
    I've sent you another example.
    Hope this works,
    Daniel.
    GeneralRe: Two or more Data Tables on single Report?memberkrzychub8 Sep '04 - 21:29 
    Sorry Daniel,
    I know, I torment You, but there are no attachments in Your last message.
     
    Thanks.
    GeneralColor printingmemberDaniel Zaharia24 Aug '04 - 21:24 
    I printed at home something and although in the PrintPreview the pages have plenty of colors, on the paper everything was black and white!
    I don't know if it is a bug, or the printer is broken…
    Can somebody clarify this for me?
    Thanks!

    GeneralRe: Color printingmemberTyraslin24 Aug '04 - 21:32 
    Have you tried to rpint something with a lot of differents colors from an another application (Word, for exemple ?)
    GeneralAbout globalisationmemberTyraslin24 Aug '04 - 8:38 
    I've tried to globalise report builder in my own project, however, it doesn't works.
    Did i need to compile the custom controls library ? When i trid to put the custom controls without recompiling, and, by putting a user-defined dictionary, i obtain nothing. All the dialog box are in english.
    (here a sample of code included in my dictionary.resx):
     
    <data name="FR_BackColor">
              <value>Couleur de fonds</value>
         </data>
         <data name="FR_BackColor_Descr">
              <value>La couleur de fonds</value>
     
    And the code i have included in my code:
     
    System.Threading.Thread.CurrentThread.CurrentCulture=
       new System.Globalization.CultureInfo("fr-FR");
     

    GeneralRe: About globalisationmemberDaniel Zaharia24 Aug '04 - 21:16 
    Hi,
    No, you don't have to recompile!
    Don't forget to put the Dictionary.resx in the same directory with the executable, and also set the CurrentCulture before showing the editors.
     
    Hope it works,
    Daniel.

    General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

    Permalink | Advertise | Privacy | Mobile
    Web02 | 2.6.130516.1 | Last Updated 11 Jun 2004
    Article Copyright 2004 by Daniel Zaharia
    Everything else Copyright © CodeProject, 1999-2013
    Terms of Use
    Layout: fixed | fluid