Using SoftArtisans OfficeWriter with SQL Server Reporting Services 2005
page 6 of 10
by Mike Campbell
Feedback
Average Rating: This article has not yet been rated.
Views (Total / Last 10 Days): 38197/ 90

Modifying the Sample Report

The report you just created is a bit ugly.  Switch back to the Layout tab and drag columns around as needed to make things look a bit nicer.  You can keep toggling back and forth between Layout and Preview mode as needed just keep entering "20" in as the location each time to get the report to render.

Once you have formatted things to look a bit nicer, it is time to address the issue of entering 20 into the location field.  If you look at the SQL that you used to generate the report, you will notice that it used a @location parameter to specify the location of parts for the query.  Each time you go to render the report, SSRS detects that a parameter is needed and prompts you for it before you can view the report.  In this case, "20" just happens to be the ID for the Frame Welding "location" at AdventureWorks.  To make this a bit more user-friendly you can do the following.

1.      Switch to the Data tab in the Designer.  From the Dataset dropdown at the top of the Data designer, select the <New Dataset> option.  In the Dataset dialog that ensues, give your new datasource a Name of LocationLookup and enter the following code for the Query string value.

Listing 2

 
SELECT
  LocationID,[Name]
FROM
  Production.Location
 
 

2.      Click the OK button to save your changes.

3.      Now, select the Report | Report Parameters menu option in Visual Studio.  The left hand side of the Report Parameters designer shows location as one of the parameters.  If multiple parameters were needed in this report, you could define their behaviors and characteristics with this tool.  In the Properties pane, specify Inventory Location as the Prompt and then select the From query radio button in the Available values section of the designer.  Then select LookupLocation as the Dataset you wish to use for this parameter and configure it to use the LocationID for the Value field and the Name column for the Label field.  Your results should look similar to those in Figure 3.  Click OK to save your changes.

Figure 3


Now when you switch to the Preview pane, you are presented with a dropdown that lets you specify which location you wish to see inventory levels for.  Just select one from the dropdown and you will get a tailored report.

In Visual Studio, save all of your changes once you are done modifying the formatting and then right click on your Report in the Solution Explorer to click on the Deploy menu option.  Your report will now be up on your specified Report Server.


View Entire Article

User Comments

Title: RA   
Name: SA
Date: 2008-04-24 12:05:05 PM
Comment:
Can Office writer help in renaming the sheet names once the report is exported from Report server
Title: Dynamic Rendering   
Name: ST
Date: 2007-10-01 6:14:24 AM
Comment:
Hi,

I have tested the code given on the above. During the render, I get this exception "Client found response content type of '', but expected 'text/xml'.
The request failed with an empty response." on the function Render(...). What am I missing on here?

Thanks.
Title: RE: Dynamic Rendering (@giovanni)   
Name: Michael K. Campbell
Date: 2006-08-31 8:37:50 PM
Comment:
Giovanni, glad you liked the article.

Make sure you've got the SoftArtisans SAXW6NET.dll copied in to your /bin/ directory - that will likely be your biggest issue.

I also generated a VB.NET conversion of the default.aspx.cs page, and posted it up in my uploads section:
http://authors.aspalliance.com/mcampbell/Default_aspx_vb.zip (but you'll need to do wire-ups for code-behind/partial classing etc...)

Cheers.
Title: Render Dynamic   
Name: GIovanni Rivas
Date: 2006-08-31 6:06:35 PM
Comment:
Hi, thx for the article, but i tryed to copy the code in cs that you give here and doesn't work, i have to so all the references to the Interop libary for excel and the methodthat you are calling there with the arguments doesn't exist. am i missing something, do you havea code in Vb.net that could work like this. thx
if you can reply at garf50@hotmail.com






Community Advice: ASP | SQL | XML | Regular Expressions | Windows


©Copyright 1998-2021 ASPAlliance.com  |  Page Processed at 2021-02-24 12:41:05 PM  AspAlliance Recent Articles RSS Feed
About ASPAlliance | Newsgroups | Advertise | Authors | Email Lists | Feedback | Link To Us | Privacy | Search