Page tree
Skip to end of metadata
Go to start of metadata

In Adding a Template to an Existing Report Defintion, we see how to add OfficeWriter template information to a saved RDL file. In that case, the database query was defined before OfficeWriter opened the file in Excel. This section will explain how to develop a report from start to finish in Excel with OfficeWriter and Microsoft Query.

Icon

Before you begin, make sure that MS Query is enabled for the OfficeWriter Designer. Instructions for enabling MS Query can be found in Using MS Query in Excel to Design Reports.

Creating a Data Source

  1. Open Excel.

  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.



  4. Click Add New to add a new database connection.



  5. Select New Data Source and click Ok.



  6. Enter a data source name and select SQL Server from the drop-down list of database drivers. Click Connect.



  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.



  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 Source dialog. Select it and click Ok to open Microsoft Query.

Building a Query

Next, we will build a query that will get the data for our report from the database. OfficeWriter Designer uses Microsoft Query to create queries. When we finished creating our sample Data Source above, Microsoft Query opened.

  1. In the Add Tables dialog box, find the HumanResources.Employee and Person.Contact table in the list and select Add.



  2. Click Close. The Employee and Contact tables should now be in MS Query.



  3. Add the Contact.FirstName, Contact.LastName, and Employee.EmployeeID fields to your query by double-clicking on the items. When you do, the columns will be added to the query.

    Your query should now look like this:



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

Adding Data Markers

A data marker is a placeholder for database values. When the report is published, OfficeWriter will replace the data markers with data from the database.

  1. Place your cursor in cell A1.

  2. Click Data Markers on the OfficeWriter toolbar and navigate the dataset you just created.

  3. Select EmployeeID from the list of fields in the dataset to insert the field in cell A1.



  4. Place your cursor in cell B1.

  5. Click Data Markers, navigate to the data set and select Lastname from the list of dataset fields.

  6. Place your cursor in cell C1.

  7. Click Data Markers, navigate to the data set and select Firstname fromt he list of dataset fields. Your report should look like this:

Saving and Publishing

Do not use Excel's File/Save menu item to save your template; use the Save button from the OfficeWriter Designer toolbar to save your template as an RDL (report definition file).

  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.

Next, deploy and view your report. Your results should look like this:

Samples

Download the .rdl file described in this section.

  • No labels