Wednesday, October 12, 2005

Reporting in Dot Net

Intended audience: Dot Net Developers and IT Managers

1.0 Reporting
Reporting can be a tricky and expensive exercise, especially if you are wanting to publish reports over the internet. There are many reporting options and tools available that can range from $1000 to $15,000 for something like Crystal Reports or SQL Server Reporting Services. Most of these options often requiring you to have a PhD in law to just understand the licensing requirements.

Fortunately there is a better way, a standard way. Using XML as your data source and an XSL stylesheet to define the design of your report, you can parse the XML and XSL files with an XSLT parser to generate your reporting output file as, for example an HTML email, a PDF download link or a Word/RTF document attachment. The beauty of using XML (www.w3.org/XML/) and XSLT (http://www.w3.org/TR/xslt) is it's an industry standard. That means you're not locked into using proprietary software and being an industry standard you should be able to get any developer off the street to pick up where your last developer left off. Potentially saving your company a lot of money.


1.1 Common Report Output Types
Most developers are asked to produce 3 common reports; HTML, MS-Word (RTF - Rich Text Format) and PDF each often requiring different applications to design and render the reports. For example one might use Visual Studio to design a HTML report, Crystal Reports to produce a PDF or SQL Server Reporting Services to produce a Word/RTF document.

Using XSL you can design a stylesheet that renders your output as XSL-HTML to produce HTML style reports, XSL-RTF to produce Word style reports or XSL-FO to produce PDF style reports. Alternatively you can use Altova StyleVision to visually design your report and automatically render all 3 reporting output styles(XSL-HTML, XSL-RTF and XSL-FO for PDF's) at once. You can download it for free on a 1 month trial. Unfortunately with the free version you can't produce XSL-FO output for PDF's, but if you're just after HTML or RTF reporting then the free version will work for you.

... This document is still a work in progress

1.2 Rendering your reports
-XSLTransformations (XSL-HTML and XSL-RTF)
-NFop (XSL-FO transformation to PDF)

1.3 Sample Code

2.0 XML Data Sources
-File, SQL Server

2.1 XML and SQL Server

2.2 XML For Auto (tree)

2.3 Sample database Stored Proc

3.0 Altova XMLSpy and StyleVision

3.1 XML, XSD, SPS

3.2 Sample XML, XSD, SPS, XSL-HTML, XSL-FO files and C# rendering code

4.0 Conclusion