Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 4.0

...

  1. Open Word and create a new blank document.

  2. # Click Add DataSet on the OfficeWriter Designer toolbar.

  3. # In the dialog box, type in a name for the query (or leave the default name "Query1"). Click Next.
    !ww_NewTemplate1.jpg!
    #
    Image Added

  4. Click Add New to add a new database connection.
    !ww_NewTemplate2.jpg!
    #
    Image Added

  5. Select New Data Source and click Ok.
    !ww_NewTemplate3.jpg!
    #
    Image Added

  6. Enter a data source name and select SQL Server from the drop-down list of database drivers. Click Connect.
    !ww_NewTemplate4.jpg!
    #
    Image Added

  7. From the drop-down list of server names, select the server where the AdventureWorks database is installed. Click Options and select AdventureWorks as the default database. Click Ok.
    !ww_NewTemplate5.jpg!
    #
    Image Added

  8. You should now be back at the Create New Data Source screen. Click
    Ok.
    #
  9. You will see your new data source in the Choose Data Sourcedialog. Select it and click Ok to open Microsoft Query.
    !ww_NewTemplate6.jpg!
    Image Added

Building a Query

...

  1. In the Add Tables dialog box, find the Employee table in the list and select Add. Then, find the Contact table and select Add.
    !ww_NewTemplate7.jpg!
    #
    Image Added

  2. Click Close. The Employee and Contact tables should now be in MS Query.
    !ww_NewTemplate8.jpg!
    #
    Image Added

  3. Add the FirstName and LastName fields to your query by dragging them from the Contact table box to the space below, as shown. Do the same with EmployeeID from the Employee table.
    !ww_NewTemplate9.jpg!
    \
    Image Added

    Your query should now look like this:
    !ww_NewTemplate10.jpg!
    #
    Image Added

  4. We will add a filter so that only current employees are returned from our query. Click Show/Hide Criteria on the Microsoft Query toolbar.
    !ww_NewTemplate11.jpg!
    #
    Image Added

  5. Pull down the Criteria Field list and select Employee.CurrentFlag as shown. Enter the value 1.
    !ww_NewTemplate12.jpg!
    #
    Image Added

  6. From Microsoft Query's File menu, select Return to OfficeWriter Designer.

...

  1. Place your cursor at the top left of your document.

  2. # Click Merge Fields on the OfficeWriter toolbar and make sure that the query you just created is selected from the list of DataSets.
    #
  3. Under Insert Merge Field on the OfficeWriter toolbar, select EmployeeID to insert the field in the document.
    !ww_NewTemplate13.jpg!
    #
    Image Added

  4. Press the Tab key to add a space after the field you inserted.
    #
  5. Repeat the above steps to insert a field for Lastname.

  6. # Type a comma and a space after the Lastname merge field.
    #
  7. Repeat the steps to insert a merge field for Firstname.
    #
  8. Press Enter. Your report should look like this:
    !ww_NewTemplate14.jpg!
    #
    Image Added

  9. Highlight the line in your document that contains the merge fields, and a blank line below the line of merge fields.
    !ww_NewTemplate15.jpg!
    #
    Image Added

  10. Go to Merge Fields > your data set > Set Selection to Repeat Region to set the highlighted area to be a repeat region.
    \
Note

Note on step 9: If you highlight the line of merge fields without highlighting a line after it, the report will repeat the fields for each row of data on the same line in the document. Since we want each row of data to appear on a new line in the document, we must select the blank line below the merge fields. This ensures that a line break is contained in the query range.

Saving and Publishing

Do not use Word's File/Save menu item to save your template. Use the Save button on the OfficeWriter toolbar to save your template as a report definition file in the RDL format.

  1. From the OfficeWriter Designer toolbar select Save > Save to Disk.

  2. # 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.
    #
  3. Save the template as an RDL file.

...