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

4 Comments:

At 10:14 PM, Blogger AlekseyP said...

This is good blog, thanks to the author.
I am using XEP from RenderX to render XLS-FO to PDF

 
At 12:14 AM, Blogger Andrew said...

4 years later?

... 8-) I know that feeling.

 
At 5:04 PM, Blogger Peter Stroll said...

Francesco, your post is great! But I tried Altova's editor, and it looks to me like it's really intended for HTML stylesheets - not a lot of options to manipulate the pagination. Do you have any experience with the Ecrion XSL-FO Formater? It looks appealing because it has a WYSIWYG XSL-FO template editor.
Thank you
Peter

 
At 11:04 AM, Blogger Francesco Fiorenza said...

Sorry guys, I wrote this blog ages ago when blogging was all the rage. I completely forgot about it!

Peter, Altova's stylevision designer allows for multiple output formats (HTML - using XSLT, RTF - using XSLT and PDF - using XSL-FO). You can insert a page break via the Insert/Page menu option and you can manipulate it with wrapped condition/if statement.

I don't have any experience with Ericon XSL-FO formatter but it sounds good :-)

cheers

Francesco

 

Post a Comment

<< Home