Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migration of unmigrated content due to installation of a new plugin

Create an Word Report from an Existing RDL

This tutorial will help you design your first report in Word using the OfficeWriter for Word Designer from a an existing report file (RDL) that was created in Visual Studio or Report Builder. To follow this demonstration you need the AdventureWorks sample database, which is an optional component in the Reporting Services installation. We will build a simple employee list and display some basic information about each employee.

Before you start, verify the following
Note
Info
titleTutorial Requirements:
  1. Reporting Services is installed
and working properly
  1. on a server you can access, working properly, and you have rights to publish and view reports.
  2. The AdventureWorks
database, which ships with Reporting Services,
  1. data base (which is an optional component in the Reporting Services installation) is installed on the Reporting Services server.
  2. OfficeWriter
with the Reporting Services renderers
  1. is installed on the
Reporting Services server.The
  1. Report Server
  2. OfficeWriter Designer
Client
  1. is installed on your local PC
.

For more information on installing and configuring OfficeWriter Reporting Services Integration, see Installation or contact your System Administrator.

OfficeWriter Designer Toolbar

The control center for creating reports with OfficeWriter is the OfficeWriter Designer toolbar. When you first start open Word, you will see the toolbar directly underneath the Word toolbar at the top of your document.Image Removedthe OfficeWriter Designer tab in the ribbon.

Image Added

If you do not see the toolbar:

  1. Open Word's View menu and select >Toolbars > OfficeWriter.
    # Check OfficeWriter. If OfficeWriter is not listed, run the OfficeWriter client installer.

If your toolbar does not contain query-building buttons (Add Query, Edit Query, etc.), your registry settings have been set to disable MS Query. These buttons are not required for this tutorial, so you do not need to make any changes to your installation.

...

  • Make sure that you ran the installer for the OfficeWriter Designer, which is a separate installer from OfficeWriter.
  • If you do not see the toolbar after running the installer, the toolbar may have been disabled. Please see this OfficeWriter Answers Post for more information.

Opening a Report File

An a RDL file is an xml-based report definition file. We will open an RDL file In this tutorial we will assume the RDL was created in Visual Studio . The file contains a database connection and a query. The query fields will appear in a drop-down list on the OfficeWriter toolbar. You will be able to insert these fields as merge fields (data placeholders) in the report template. You will not be able to create additional queriesor Report Builder. If you are interested in creating RDLs with the OfficeWriter Designer, read Using MS Query in Word to Design Reports.

  1. Open Microsoft Word and create a new file.
    # Click the Open Report button on the OfficeWriter toolbar.
    #

  2. Go to the OfficeWriter Designer tab and click Open Report

  3. If your report definition defintion file was saved on a local or network drive, navigate to the folder containing the file, select it, click Open, and continue to step 2. Adding Fields to your report
    If your report definition RDL file was deployed to Reporting Services, click the Retrieve on the bottom right corner of the dialog box, and continue to step 3.
    !ww_FirstfromRDL1.jpg!
    #
    Image Added

  4. In the Report Browser dialog box, type in your report server's URL or Domain name and click Refresh. This will load all the available report folders into the list box. Navigate to your report file, select it, and click Ok.

...

Adding Merge Fields to Your Report

For this demonstration we will use a report file When you open the report, the Designer parses the RDL for information about the data sets and makes that information available while you are working in Word. Data sets will appear in a drop-down list and you will be able to insert fields from those data sets into the Word template as data placeholders called data markers.

For this tutorial we will use an RDL that was created in Visual Studio containing a data set with the following query:


After opening your report in Word with the OfficeWriter toolbar, you should find your query listed under the Select Query button Merge Fields > DataSets.

  1. Place a two column, two row table in your report template.
    !ww_FirstfromRDL6.jpg!
    # Click Select Query on the OfficeWriter toolbar and select
    Image Added

  2. Place your cursor in the top left cell of the table.

  3. Go to Merge Fields in the OfficeWriter Designer toolbar and locate your query from the drop-down list.
    !ww_FirstfromRDL4.jpg!
    # Place your cursor in the top left cell of the table click inside it.
    # Click Insert Merge Field and select the LastName field
  4. Hover over the query to open the Merge Field Menu.

    Image Added

  5. Select LastName from under Insert Merge Field to insert a merge field into the table cell. Your report should now look like this:
    !ww_FirstfromRDL7.jpg!
    #
    Image Added

  6. After the AdventureWorks.LastName merge field, type in a comma comment and a space. Select Go to Merge Fields > the data set > Insert Merge Field again and pick the select FirstName field. Your report should now look like this:
    !ww_FirstfromRDL8.jpg!
    #
    Image Added

  7. Place your cursor in the top right cell of the table. Select Go to Merge Fields > the data set > Insert Merge Field and pick select Title.

  8. # In the bottom left cell, type Employee ID: and insert the EmployeeID field.
    #
  9. Place your cursor in the bottom right cell of the table. Click Insert Merge Field and select the EmailAddress field.

Your finished report template should look like this:
Image Removed

Step 3. Set a Query Range

The range of a query specifies whether all or just the first record returned by the query will be displayed in the report. See Setting Query Range section for a detailed explanation of query range.

There are two different query ranges: Document and Selection. If a query's range is document, only the first record returned by the query will be displayed in the report. If the range is selection, all records returned by the query will be displayed in the report.

...

Image Added

Setting a Repeat Region

There are two ways to import data into an OfficeWriter for Word report: at the Document level or in a Repeat Region. If a dataset is imported at the Document level, merge fields from this query can appear anywhere in the document, and only the first row of data is imported into the report. If a dataset is imported into a Repeat Region, merge fields for that dataset must be contained in a section of the document wrapped in a special bookmark. Everything within the bookmark region will be repeated for each row of data in the dataset.

By default, all merge fields are considered to be at Document level. To set a dataset to import into a Repeat Region:

  1. With your mouse, highlight the entire table on your report. Select not only the table, but also include a the blank row below the table.
    !cfwr_figure11.jpg!
    # Select Query Range from the OfficeWriter Designer.
    # Make sure that Selection is chosen and click Ok
    Image Added

  2. Go to Data Markers > the data set. Under Repeat Region, select Set Selection to Repeat Region to wrap the section in the repeat bookmark.
Note

If you highlight a table without highlighting a row after it, the report will include a separate table for each employee without spaces between them. It would look like one long continuous table. Many times you will want to do this, but for this demo, we want to make it look like separate tables.

...

Publish and View

...

Your Report

Before publishing the report on the Reporting Services server, we must save the Word template locally as an RDL file.

  1. From the OfficeWriter Designer toolbar select Save As.
    # . You will have the option to Save to Disk or Deploy to Remote Server.

  2. Select Save to Disk.

  3. Navigate to a local folder where you will store the template report file. This will be where you store your work file in case you want to edit it later, not a location on the Reporting Services server.
    #
  4. Save the template as an RDL file.
    #
  5. To publish the report, from the toolbar, select Publishclick Save and select Deploy To Remote Server.

  6. # From the Publish dialog box select the drop-down to display the Server or URL.
    #
  7. Choose the server on which Reporting Services is installed.
    #
  8. Click Refresh.

  9. # Select a folder for which you have publish rights and click Ok.

  10. # If your report published with no errors, you will receive a Publish Successful message dialog. Click Ok to continue.

  11. # To view the report, click View on the OfficeWriter Designer. The report viewer will open another Word window with the report results. It should look like this:
    !ww_FirstfromRDL12.jpg!
    #
    Image Added

  12. Select Close Report View to return to your report template.

...

  1. Open a browser and go to the Reporting Services Report Manager (usually installed at http://<server address>/Reports).
    #
  2. Navigate to where you published your report.

  3. # Select the report. Reporting Sevices will display the report but only show you the data set.
    #
  4. From the Select a format export option drop-down, choose Word designed by OfficeWriter.
    # Click Export and - when prompted -
  5. When prompted, click Open . Word will open and display your report the way you created it.

Samples

Download an RDL file with each result displayed in a separate Word table.Download an RDL file with all results displayed in one Word tablethe .rdl file described in this tutorial.