Glossary Item Box
ActiveReports provides custom components for several formats, including PDF, HTML, RTF, TIFF, Excel and plain text. Ultimate customizability is available by using any ASP.NET language.
This walkthrough illustrates how to create a simple Web application and set up custom exporting in TIFF format.
This walkthrough is split up into the following activities:
To complete the walkthrough, you must have access to the NorthWind database (NWind.mdb). You must also have access to Internet Information Services either from your computer or from the server. You must also run the "Configure Web Sample" option from the Data Dynamics ActiveReports for .NET 2.0 program menu from your Windows Start button.
When you have completed this walkthrough, you will have a TIFF image that looks similar to the following.
Important: If you are using Visual Studio.NET 2005, please see the Visual Studio.NET 2005 Web Changes topic.
To add an ActiveReport to your project
To connect the report to a data source
To add controls to the report
Control | Name | Text/Caption | Location |
---|---|---|---|
Label | lblProductID | Product ID | 0, 0 |
Label | lblProductName | Product Name | 1.0625, 0 |
Label | lblUnitsInStock | Units In Stock | 2.6875, 0 |
Label | lblUnitsOnOrder | Units On Order | 3.75, 0 |
Label | lblUnitPrice | Unit Price | 4.8125, 0 |
Control | DataField | Name | Text/Caption | Location | Output Format |
---|---|---|---|---|---|
TextBox | ProductID | txtProductID | Product ID | 0, 0 | (Empty string) |
TextBox | ProductName | txtProductName | Product Name | 1.0625, 0 | (Empty string) |
TextBox | UnitsInStock | txtUnitsInStock | Units In Stock | 2.6875, 0 | (Empty string) |
TextBox | UnitsOnOrder | txtUnitsOnOrder | Units On Order | 3.75, 0 | (Empty string) |
TextBox | UnitPrice | txtUnitPrice | Unit Price | 4.8125, 0 | Currency |
To add the TIFF Export control
Note: If you are using Visual Studio 2005, please see Visual Studio.NET 2005 Web Changes.
To write the code in Visual Basic
To write the code in C#
The following example shows what the code for the method looks like.
' Visual Basic
Private Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles _ MyBase.Load
Dim m_stream As New System.IO.MemoryStream()
Dim rpt As New rptTIFF()
rpt.Run()
Me.TiffExport1.CompressionScheme = DataDynamics.ActiveReports.Export.Tiff _ .CompressionScheme.Lzw
Me.TiffExport1.Export(rpt.Document, m_stream)
m_stream.Position = 0
Response.ContentType = "image/tiff"
Response.AddHeader("content-disposition","inline; filename=MyExport.tiff")
Response.BinaryWrite(m_stream.ToArray())
Response.End()
End Sub
//C#
private void Page_Load(object sender, System.EventArgs e)
{
System.IO.MemoryStream m_stream = new System.IO.MemoryStream();
rptTIFF rpt = new rptTIFF();
rpt.Run();
this.tiffExport1.CompressionScheme = CompressionScheme.Lzw;
this.tiffExport1.Export(rpt.Document, m_stream);
m_stream.Position = 0;
Response.ContentType = "image/tiff";
Response.AddHeader("content-disposition","inline; filename=MyExport.tiff");
Response.BinaryWrite(m_stream.ToArray());
Response.End();
}
See Also |
Tasks: Visual Studio.NET 2005 Web Changes
Copyright © 2004-2005 Data Dynamics, Ltd. All rights reserved.