Question

Given a data set containing multiple rows, from within a .NET console application I need to generate a report on a single page for each row, sending those pages directly to the printer.

I am attempting to use Microsoft Report for this by attaching it to a data set and placing TextBoxes where I wish. Generating the report and sending it to the printer are not a problem. Unfortunately, the data only seems to be available in aggregates -- First, Sum, Last, Max, etc. I cannot latch the text box to a bare field.

Some poking around here and other sites seems to address this, but only when the data is presented in a table. One post even said without elaboration, "My mistake was using Text Boxes"

Am I using the wrong tool for what I am attempting to accomplish?

Was it helpful?

Solution

I ran into the same problem and managed to solve it. The solution seems a little convoluted to me so don't quote me on the "right" way to do this, but here is what I did:

  1. Make sure you have a Dataset defined for your report.
  2. Add a "Table" control to the report. This seems to be needed in order to iterate the rows in your Dataset.
  3. Delete the header row and two of the default columns from the table so that you are left with a single row with a single column.
  4. Expand the table to the width of your layout and make it as tall as you will need for your "free form" layout.
  5. By default, there is a TextBox inside the table cell. Right-click the empty table cell and choose "delete" to remove that TextBox.
  6. Drag a "Rectangle" control into the empty table cell. It seems to automatically "dock" to the width/height of the table cell.
  7. Now you should be able to drag the fields from your DataSet (TextBoxes, etc) into the Rectangle to produce the desired layout.

Note that I am in the early stages of using this approach so I'm not sure if I am going to hit any walls... but for a basic report that uses TextBoxes and a page break after each "row" it seems to be working ok.

OTHER TIPS

Or you try to use a list. In the list you can arange textboxes (and other controls) as you want and they will be filled for each record in the recordset.

This work for me. :-)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top