Report Element
The Report element is the top-level object that defines the entire report. You must add all content to a report by way of a Section element. Most layout elements use methods to create additional and nested layout elements; this is the same for the Report element, but you can add only one layout element type, the Section element, to the Report element. An easier way to understand this concept would be to visualize it as an object model diagram. For example, a report’s layout can be as simple as the following tree:
-
Report
-
Section
-
Section
-
Section
-
Section
-
Section
You can see from the above tree that Sections are the only layout elements you can add to the Report element. Section elements can contain any content element aside from another Section element. Logically, if you can only add a Section element to a Report element, then you would need to be able to add everything to a Section element.
The Report element also has several other properties and methods that are important for report writing. Below is a short list of report features you are likely to use frequently.
-
Bookmarks — Use the Bookmarks property to add bookmarks to your PDF document.
-
Information — You can add information about the report such as the Author, Company, Copyright, Title, Subject, and more.
-
Saving and Loading as XML — You can use the Save method to save your full report as an XML file. At a later time, you can load the content of the report from the saved XML file with the Load method.
-
Publishing your Report — When you’ve finished your report and are ready to create a PDF document from it, you will use the Publish method to write a PDF, XPS, or plain text document. For more information on the Publish method, see Publish a Report.
The following code will produce a report with the same structure as the tree above. This example does not set any other properties, it only instantiates objects. For example code that shows more detail, see each individual element’s help topic for additional information.
Imports Infragistics.Documents.Reports.Report
Imports Infragistics.Documents.Reports.Report.Section
Imports Infragistics.Documents.Reports.Report.TOC
Imports Infragistics.Documents.Reports.Report.Index
Imports Infragistics.Documents.Reports.Report.Band
Imports Infragistics.Documents.Reports.Report.Flow
Imports Infragistics.Documents.Reports.Report.Table
.
.
.
Dim report As Report = new Report()
Dim section1 As ISection = report.AddSection()
Dim group1 As IGroup = section1.AddGroup()
Dim seciton2 As ISection = report.AddSection()
Dim tableOfContents As ITOC = section2.AddTOC()
Dim section3 As ISection = report.AddSection()
Dim band1 As IReportBand = section3.AddBand()
Dim flow1 As IFlow = band1.AddFlow()
Dim section4 As ISection = report.AddSection()
Dim table1 As ITable = section4.AddTable()
Dim section5 As ISection = report.AddSection()
Dim index1 As IIndex = section5.AddIndex()
using Infragistics.Documents.Reports.Report;
using Infragistics.Documents.Reports.Report.Section;
using Infragistics.Documents.Reports.Report.TOC;
using Infragistics.Documents.Reports.Report.Index;
using Infragistics.Documents.Reports.Report.Band;
using Infragistics.Documents.Reports.Report.Flow;
using Infragistics.Documents.Reports.Report.Table;
.
.
.
Report report = new Report();
ISection section1 = report.AddSection();
IGroup group1 = section1.AddGroup();
ISection section2 = report.AddSection();
ITOC tableOfContents = section2.AddTOC();
ISection section3 = report.AddSection();
IReportBand band1 = section3.AddBand();
IFlow flow1 = band1.AddFlow();
ISection section4 = report.AddSection();
ITable table1 = section4.AddTable();
ISection section5 = report.AddSection();
IIndex index1 = section5.AddIndex();