WordML in Reporting Services

Although Reporting Services is almost 22 months old, I haven't found any pure render extension yet (please comment on this[:-*]). Many people ask me 'how can I export reports in Microsoft Word format?', and I usually redirect them to our BOL. But after looking up in the RS documentation, I realized that it is not as straighforward as expected, so I will try to simplify it.

ReportingService.Render Method

You can find easily this method in the documentation , it explain how to render a built report programmatically. In our sample the most important parameters are:

  • Format, Reporting Services allows you to export the report from the IF to any format configure as rendering extension. So w can export by default to: XML, CSV, IMAGE (Different image format here), PDF, HTML4.0, HTML3.2, MHTML, EXCEL and HTMLOWC. We will choose XML.
  • DeviceInfo, it is a XML string that contains the necessary information for the rendering extension chosen above.

Then we can take a closer look to the XML Device Information Settings.

Here we have (XSLT, MIMEType, UseFormattedValues, Indented, OmitSchema, Encoding, FileExtension, Schema), I will comment the first one XSLT. It will be the path in the report server namespace of an XSLT to apply to the XML file. This means that you can upload a XSL file, and include its path here.

The approach I'm following to create Microsoft Word Format, is based on WordML Format, and you can use:

  1. Microsoft Office Word 2003
  2. Word Viewer 2003 (standalone application)
  3. Word 2003: XML Viewer (Internet Explorer)
  4. Any other application that consumes WordML.

to see the final doc.

Is there an easy way?

Well, you can follow the sample and create an application that creates a WordML file....or you can use Reporting Services URL Access and do it in  a simple way.

So we follow these steps:

  1. Create a report based on AdventureWorks2000 database, with Data Source (Check it).
  2. Deploy them to the ReportServer
  3. Create the XSLT to convert from XML (RS rendering) format to WordML format (Check it).
  4. Uploaded the file transform01.xsl to MyXSLT folder
  5. Create a URL Access with all the information:
    1. https://localhost/ReportServer?
    2. /RSDemos/AdW2KProducts
    3. &rs:Format=XML&rs:Command=Render
    4. &rc:XSLT=/MyXSLT/transform01.xsl
    5. &rc:FileExtension=doc  (you may try &rc:FileExtension=xml too due to the Word PI)
    6. &Category=22
  6. Access the URL (Check it).

And that's it, we have our WordML report.

We could create RTF documents following the same pattern.

What about better documentation

Yes, I know BOL RS could be better (Eyerthing can improve!), and that is the reason we heard from customers and improve the documentation (and improve the searching [;)])!

Check the MSDN / MSDN2 docs:

HTML Report

WordML Report

BOL, RS, WordML, XSLT, URL, IF, RTF, XML, PDF, CSV, MSDN

[Updated links MSDN / MSDN2 18-Oct-2005]

[Updated text and transform01 22-Mar-2006]