|Posted: 08/26/2013, 3:33 PM
I really like using designs in my CCS5.x projects, especially designs created with Artisteer. One issue I had was with reports. They displayed fine on the screen but didn't print out very well. Switching over to styles when it came time to generate reports wasn't pretty. So I came up with the following solution that displays the report on a page that uses designs but changes to using styles when you click on the Printable Version link. I use the ASP.Net InMotion templates but it may be adaptable to other templates/languages.
Step 1. Create a blank page but don't apply a design to the page so it will use styles (or dynamic styles). I called mine "printable_version.ccs". You will create this page only once and use it for all of your reports. In the Page_BeforeInitialize event, add the following code.
If Not String.IsNullOrEmpty(Request.QueryString("ReportName")) _
AndAlso Request.QueryString("ReportName").ToLower.EndsWith(".ascx") _
AndAlso System.IO.File.Exists(Server.MapPath(Request.QueryString("ReportName"))) Then
Step 2. Create your report on an includable page. Just the report by itself, no search parameters. Mine was called "cart_service_manifest_rpt_incl"
Step 3. Create a new page and apply design to it. This page will contain the search parameters for the report and an include control for your report from the previous step. Change the Printable Version link Href Source to your page from step 1 (printable_version.ccs). Add a parameter with source type of Expression, Parameter Source = "~/cart_service_manifest_rpt_incl.ascx" (change to your report name), and parameter name = ReportName.
Now when you click the Printable version link, the printable_version page will open in a new window with the includable report you created in step 2.