|
using System;
using System.Drawing;
using ReportPrinting;
namespace ReportDocumentTesting
{
/// <summary>
/// This class makes use of the Layered container.
/// That is, each section has access to the full size of the
/// container, which in this case is the page.
/// </summary>
public class ReportTest2 : IReportMaker
{
public void MakeDocument(ReportDocument reportDocument)
{
TextStyle.ResetStyles();
// We'll add a background to the normal style
TextStyle.Normal.BackgroundBrush = Brushes.Beige;
// Start a layout of layers - each section is layed out without
// regard to previous sections. It is, in fact, on a layer above.
// We'll use parameters of the ReportSection to set where each
// of nine text sections are printed.
ReportBuilder builder = new ReportBuilder(reportDocument);
builder.StartLayeredLayout(true, true);
string text = "Proofread carefully\nto see if you\nany words out.";
SectionText section;
// The default location of a section if we don't set the values.
section = builder.AddText(text, TextStyle.Normal);
//section.HorizontalAlignment = HorizontalAlignment.Left;
//section.VerticalAlignment = VerticalAlignment.Top;
section = builder.AddText(text, TextStyle.Normal);
section.HorizontalAlignment = HorizontalAlignment.Center;
section.VerticalAlignment = VerticalAlignment.Top;
section = builder.AddText(text, TextStyle.Normal);
section.HorizontalAlignment = HorizontalAlignment.Right;
section.VerticalAlignment = VerticalAlignment.Top;
section = builder.AddText(text, TextStyle.Normal);
section.HorizontalAlignment = HorizontalAlignment.Right;
section.VerticalAlignment = VerticalAlignment.Middle;
section = builder.AddText(text, TextStyle.Normal);
section.HorizontalAlignment = HorizontalAlignment.Right;
section.VerticalAlignment = VerticalAlignment.Bottom;
section = builder.AddText(text, TextStyle.Normal);
section.HorizontalAlignment = HorizontalAlignment.Center;
section.VerticalAlignment = VerticalAlignment.Bottom;
section = builder.AddText(text, TextStyle.Normal);
section.HorizontalAlignment = HorizontalAlignment.Left;
section.VerticalAlignment = VerticalAlignment.Bottom;
section = builder.AddText(text, TextStyle.Normal);
section.HorizontalAlignment = HorizontalAlignment.Left;
section.VerticalAlignment = VerticalAlignment.Middle;
section = builder.AddText(text, TextStyle.Normal);
section.HorizontalAlignment = HorizontalAlignment.Center;
section.VerticalAlignment = VerticalAlignment.Middle;
builder.FinishLayeredLayout();
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.