Library tutorials & articles
Printing Reports in .NET
Layouts
Linear layout
The LinearSections class is used to print a variety of sections, one below (or next to) another. In its simplest form, the linear layout looks like the figure to the right.
Each section may consume a different amount of real-estate. Some may be as wide as the page, others may not. The LinearSections container (shown in color) is a rectangle as wide as the widest section and as tall as all sub-sections combined.
This is the simplest class to use for structuring a report. Simply start a LinearLayout with the ReportBuilder class and then add ReportSections for text and data as needed.
Layered layout
The layered layout is for combing sections together into one region. This is often used for placing varying ReportSectionText objects together in one PageHeader or PageFooter. It could also be used to add a watermark to the body of a ReportDocument.
Column layout
As the name suggests, the column layout is used for creating columns on a page. A picture of a document using columns can be found on the samples page.
The column layout contains a vertical LinearSections container nested within a horizontal LinearRepeatableSections container. The vertical container has a maximum width of the column width. It renders as much of its content as possible within a column, then returns to the horizontal container. The horizontal container advances by the width of the column (plus any margin required in the middle) and repeats the call to the vertical container. This gives the parent container the name LinearRepeatableSections since it will repeat calls to a child section within a single page.
In the example shown, the LinearRepeatableSections has a special divider section assigned to it of a vertical line. This divider is printed between calls to the vertical section.
Box section
The box isn't stricly a container in the class hierarchy sense, since it doesn't inherit from SectionContainer. However, it does contain one section which can be assigned to it. And the ReportBuilder class, when it supports the SectionBox, will treat it as a container by assigning a layered or linear container to the box.
The box follows many of the properties from the W3C box model. I recommend visiting this page to learn more.
(graphic from w3.org)
The margins are set the same as for any other report section. The margins are always clear. The borders are set by specifying a System.Drawing.Pen object to use for each border. The pen object specifies color and width. The padding is specified in inches, again for each side independently.
If a background brush is set (using the System.Drawing.Brushes), it will paint the entire area inside the border (including the padding).
The width and height can each be set independently, or not at all. If the width is not specified, then the width will size to that of the contents. If the width is explictly set using the Width property, that width includes content, padding, border, and margins. The width can also be set as a percentage of the parent (using the WidthPercent property). The same is true for the Height and HeightPercent properties.
An offset can be set which moves the box in relation to the parent and normal flow. This should normally be used in LayeredLayout, as the results in LinearLayout haven't been adequately tested.
Related articles
Related discussion
-
String was not recognized as a valid DateTime.
by buvanasubi (22 replies)
-
ASP.NET Patterns every developer should know
by AndyGrant2005 (2 replies)
-
help me to get simple requirement
by Slicksim (1 replies)
-
Compatibility Issue on Firefox to display on Cursor Location
by ansari.wajid (0 replies)
-
Cursor Location in Freetextbox
by ansari.wajid (1 replies)
Related podcasts
-
Looking into the C# Crystal Ball with Charlie Calvert and Bill Wagner
One of the most exciting announcements from PDC was the news about C# 4.0 and Visual Studio 2010. With all the excitement and discussion throughout the event about these new developer tools, we reached out to two experts in the fields. Charlie Calvert and Bill Wagner sat down with Keith and Woody...
Events coming up
-
Dec
6
Developing AJAX Web Applications with Castle Monorail
London, United Kingdom
Monorail is the model-view-controller engine of the Castle Project, bringing many of the best ideas of Ruby on Rails to the .NET world. In this talk, David De Florinier and Gojko Adzic show how Monorail makes it easy to develop .NET based AJAX applications, and how to use the Castle Project to build Web 2.0 applications effectively. Come to this session if you are a .NET web developer. Everyone is welcome!
Fist of all you have to learn how to program, but I think it's better that you learn how to read.
Simple, I hope, question - What and how do I add the "Library" to my C# VS2005 project?
I.m new to C# and VS 2005. This is my first project. ReportPrinting appears to be just what I was looking for, but it doesn't run in VS 2005, yet I can execute the ReportDocumentTesting.exe from within the Debug directory.
Thank you,
Jim
Borland Delphi and Borland C++Builder users often ask us, “Which report generator to choose: either FreeReport or FastReport 2., or FastReport 3.?”, “Why FastReport 2 and FastReport 3 both are available for registration?”
We are always glad to help you with your choice. Moreover, everything is rather simple – answer some questions and the choice will be obvious.
So:
1. Are you going to create application programs with report generator functions only for Windows? (in that case we advise you to decide only between FreeReport and FastReport 3)
2. Do you write free programs, go in for programming as a hobby – for yourself and do not intend (not plan yet) that this occupation will bring you profit? (in that case we advise you to use FreeReport – a fully free solution, which even now has a more serious functionality than most of commercial report generators for Delphi. And the availability of detailed documentation /that is absolutely unique for free product/ allows us to recommend this solution even to beginners in programming).
3. Do you intend to create cross-platform application programs or programs for Linux via using Borland Kyilx development framework? Or do you prefer application suite, which partially Linux-based, and partially MS Windows-based? (In that case FastReport 2.* CLX or FastReport 2.* CLX + FastReport 2.* VCL bundle – remarkable for the full compatibility; moreover, FastReport 2.* VCL supports a great number of capabilities peculiar to MS Windows platform - will suit you.
4. Do you use high technology in your work, know XML advantages? Are you interested in multithreaded report building? Do you need the full set of functions that report generator possesses (beginning with turning of the text to any angle and floating of the text from one block to another and ending with export filters precisely set in different formats including such as PDF, HTML, XLS etc. and report servers creation for distributed corporative applications <detailed comparison table is here >
And some more additions:
1. FastReport 3 exists today only in VCL variant (that is why VCL is not pointed out in its name), whereas FastReport 2.5* exists both in VCL and CLX variants – that is why the variant in FastReport 2.5* name is pointed out obligatory.
2. There is no need to be afraid of becoming a “solution hostage” after choosing FastReport 2 or FreeReport. Both FastReport 2 and FreeReport contain built-in means for converting reports from FastReport 2 format into FastReport 3 format.
3. For all FastReport 2 and FastReport 3 users of earlier delivered variants a privileged transition to FastReport 3 (of any variants of delivering) for variation in prices is foreseen.
4. FastScript, which is delivered being included into FastReport 3 Standard and higher, may be used in applications and separately from FastReport 3.
????
????
FreeReport is a reporting tool component. It consists of report engine, designer and preview. Its capabilities are comparable with that of Crystal Reports. It is written on 100% Object Pascal and can be installed in Delphi 4-7,2005 and C++Builder 4-6.
This version of FreeReport is based on FastReport ver. 2.32.
ROYALTY-FREE with FULL source code
See more here: http://www.fast-report.com
Hello,
By now you probably figured it out, but you have to do something like this:
dv = dt.DefaultView;
SectionTable st = builder.AddTable(dv, false, 100.0f);
st.SuppressHeaderRow = true;
st.OuterPens = st.InnerPenHeaderBottom = st.InnerPenRow = null;
builder.AddColumn("Col1", "", 1.5f);
builder.CurrentColumn.RightPen = null;
builder.AddColumn("Col2", "", 2.7f);
builder.CurrentColumn.RightPen = null;
I've been fighting with this library for the entire day, and I hope it helps you!
-- LuisR
Hi Mike
Thanx for the great stuff you gave us for free.
I hope you still read this coz I have a small problem. Please tel me how to remove grid when I print dataview.
Regards
Al
Some information on FastReport 3:
- Rewritten class architecture.
- Storing reports in XML format.
- Full WYSIWYG (now for text objects too).
- Text rotation 0..360 degrees.
- Memo object supports simple html-tags (font color, b, i, u, sub, sup).
- Styles, Text flow.
- URLs, Anchors.
- Dot matrix reports.
- One script in the report (like an unit in the Delphi), Multi-language architecture allows you to use many languages
(Pascal, C++, Basic, Java).
- Access to any object inside your application (in case you've allowed this). Standard libraries to access to base classes,
controls and forms. Easily expandable library architecture.
- Debugger, Improved Object Inspector.
- Zooming, Rulers, guides.
- Wizard for base type reports.
- Full Undo/Redo.
Read more: http://fast-report.com/en/fr3.php
Features comparison (compare FastReport 3 with the current version of FastReport):
http://fast-report.com/en/comparison.php
Price-list: http://fast-report.com/en/upgrade.php
Download FastReport 3: http://www.fast-report.com/en/download.php
Hello all,
I have a little .NET vs. VS 6 user control curiosity! ^_^ any takers?
If I have a project that contains a user control that I made in VS6 and then want to convert it to VS.NET, can I still call the component /dll from within a test application that was created mainly in VB6? Does anyone have exerience with the conversion of user controls - because when the project with the user control is converted to .Net, the user control code is totally gone in the .Net version of the project!
Well a little insight would help me a long way!
Thanks guys,
Maria
This thread is for discussions of Printing Reports in .NET.