Simple Report Example
Laying out a report in DynamicPDF Designer is very simple. In this example we will walk step by step in setting up a straightforward report using DynamicPDF Designer. The report layout will be saved as a DPLX file which can then be referenced from within DynamicPDF ReportWriter. This example requires access to the Northwind database.
1. Open the DynamicPDF Designer
Open the Designer from the Start menu (Start -> All Programs -> DynamicPDF [version] for [platform] -> DynamicPDF Designer) or double click on the DynamicPDF Designer shortcut installed on the desktop.
2. Open and Save a New ReportFile
On the File menu select "New"
OR
Click on the new file icon
OR
Press Ctrl+N.
Any new report first specify a save location and name before working on the file. Report Files will always be given a DPLX extension.
Note: Ensure that the DPLX file is saved in a location accessible by the ReportWriter application.
Figure 1 - A new blank report in DynamicPDF Designer
3. Define a SQL Database Query (or Stored Procedure)
In this example we will use a SQL query. You can also use a stored procedure. Follow these steps to define a query:
1. On the "Properties Box", from the drop down list, select "Report" item. (If the properties window is not visible click "View" and select "Properties Box" or press F4)
2. In the "Data" section, click the "Query" property label.
3. Click the button to open a new Query Editor window (see Figure 2).
4. From the drop-down list, select "SQL" to define a SQL query.
5. In the "Connection String" box, define the connection to establish a connection with the NorthWind database.
6. In text box, specify the SQL statement. For example "SELECT CompanyName FROM Customers" (see Figure 2).
7. Click "OK".
Figure 2 – SQL Connection String and Query Window
4. Layout Report
Report elements can now be placed on the blank report in a drag and drop fashion (see the "Elements of a Report" topic for more details on each element). All sizes below are listed in points. To change the units for Designer click on the "Layout" menu, select "Units" and click "Points" (for conversions there are 72 points per inch) or "Inches" or "Centimeters".
Drag and drop the following elements:
1. "Record Box" into the "Detail" section of the report. Change the Record Box’s properties in the "Properties" window: Field = CompanyName, Width = 512, X = 0 and Y = 0.
2. "Label" into the "Header" section of the report. Change the Label’s properties in the "Properties" window: FontSize = 18, Text = CustomerList, Height = 20, X = 206 and Y = 0.
In the properties window, from the drop down list select the Report. Resize the Report’s Appearance Properties in the "Properties" window as follows: DetailHeight = 14, FooterHeight = 0 and HeaderHeight = 22.
5. Save and Close the DPLX file
On the File menu, click "Save"
OR
Click the save icon
OR
Press Ctrl+S.
To close the Designer,
On the File menu, click "Close"
OR
Click the "X" in the upper right corner.
6. Referencing the DPLX file from ReportWriter
To create the final PDF report, the saved DPLX file can now be referenced from within your ReportWriter code. For example, some simple C# or VB.NET code to create the final report might look like this:
DocumentLayout reportDocument = new DocumentLayout( @"Filepath/ReportLayoutName.dplx" );
Document document = reportDocument.Run();
document.Draw( @"C:\\Temp\\report.pdf" );
Dim reportDocument As DocumentLayout = New DocumentLayout("Filepath/ReportLayoutName.dplx")
Dim MyDocument As Document = reportDocument.Run()
MyDocument.Draw("C:\\Temp\\report.pdf")
Please refer to the DynamicPDF ReportWriter section of the Help Library for more information on using DPLX files from within ReportWriter.