Link to home
Start Free TrialLog in
Avatar of Bad_billy
Bad_billy

asked on

CRM 4.0 reports are exporting to PDF in portrait format only. Can someone tell me how to get these to export in landscape layout?

The matter is that somewhere in the report server that supports CRM 4.0 the system is configured to export the report to PDF in portrait layout.  I need this value to be adjusted to landscape... and preferably selectable by report since some look good in portait while others need landscape.
Avatar of ValentinoV
ValentinoV
Flag of Belgium image

I don't know CRM 4.0 but as far as SQL Server Reporting Services is concerned (which I assume CRM is using, as you've added the SQL Reporting zones), the fact whether a report is portrait or landscape is defined in the report itself.

Brian Welcker wrote a really good explanation of this: http://blogs.msdn.com/bwelcker/archive/2005/08/19/454043.aspx
Forgot to mention: if you can find where the reports (.RDL) are stored in the CRM system, it should be possible to change their orientation using the Business Intelligence Development Studio.
Avatar of Bad_billy
Bad_billy

ASKER

Please bear in mind that I am not trying to print the report at this point... I am trying to export it as a PDF.  

Also, while the dimensions of the report can be adjusted in the report development environment in the properties, there appears to be no property to define the layout (portrait or landscape).  If you know of the property, please advise because I cannot find it.  
Controlling the orientation when exporting to PDF is similar as for printing, PDF (just like TIFF) is a kind of "print" layout, the pages are fixed in those formats, as opposed to for instance HTML.

To change a report from portrait to landscape (or vice versa), you need to swap two report properties: PageWidth and PageHeight (not to be confused with their InteractiveP... versions which are only applicable for the interactive reports such as HTML - which is what you use when looking at the report through the Report Viewer)
To reiterate; when viewing a report in the CRM report viewer, one has the option of exporting the report to PDF.  Regardless of the length and width of the report, the driver that produces the PDF document produces it in a portrait orientation.  I am realizing that my question has NOTHING to do with the page and width of the report at development time and everything to do with the settings of the driver on the server that generates the PDF at run time.  This really is not a report issue and more of a CRM server or SSRS server driver setting issue.  

So, as I am clarifying this, I am realizing that I might have pointed the conversation in a wrong direction.  I would still like the end user to be able to determine the orientation of the document that will be produced for me through the export process at time of export (probably Dynamics CRM functionality change), but I would still like to know where those server settings reside... perhaps there is a way to manipulate it through some custom venture.  

Any takers?
I see what you mean and I hope for you that CRM 4 offers that kind of functionality somehow.  But if CRM 4 depends on SQL Server Reporting Services for the export then as far as I know the only way to control portrait/landscape is in the actual report definition.

If you think about this, it's really not that easy to support both ways in the same report.  A reports consists of several objects, such as Table, Matrix, Textbox, Image, Tablix (in SQL2008)...  When you'd switch a report from portrait to landscape, to optimize space usage some of these controls would need to resize automatically to take advantage of the extra space. Imagine a table with 5 columns, 2 of them contain a description, 2 a price and one an amount.  Should each column resize equally?  Preferably you'd like the columns containing descriptions to get larger than those containing numbers.  And that should then be configurable somehow.  Or alternatively the engine should be intelligent enough to take the column's data type into account.  But then the report designer (person, not the app :-) should still be able to override these engine assumptions to avoid unwanted resizing situations.

As you see, something that seems simple suddenly becomes quite complex.  Again, I do hope CRM 4 has something built in that could support this, but I really doubt it.  If they do have the flexibility I would be really interested in how they've combined that with SSRS :-)
The focus is not the report.  Its the server-side driver producing the exported PDF that is dicatating the orentation, not the design of the report, for even if the report were made to work in landscape, the exported PDF would still not give you a landscape orentation in the printout.  

Comments about the driver and its settings specific to the PDF export please?.  
ASKER CERTIFIED SOLUTION
Avatar of ACTGuru
ACTGuru
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I resized the layout in the report parameters and shrunk things up on the page layout where the tables set and it still doesn't export in landscape.  
I've thought of another way in which portrait/landscape can be controlled.  I'm not sure how this applies to CRM 4.0 but it does seem that there's a regular SQL Server Reporting Services server running behind it somewhere so maybe you could use this system as well.

The ReportServer web service allows quite a lot of configuration through its URL. This configuration includes the rendering format.  Each format device also has its own set of parameters.  The following URL (parts in capitalized letters to be customized to your situation) loads a report in PDF while setting the PageHeight and PageWidth parameters to result in a landscape report.  I tested this with a report that by default renders in portrait and it worked perfectly.

http://YOUR_SERVER/ReportServer?/PATH_TO_REPORT/REPORT&rs:Format=PDF&rc:PageWidth=11in&rc:PageHeight=8.5in

The following BOL page has a list of all PDF device parameters: http://msdn.microsoft.com/en-us/library/ms154682(SQL.90).aspx
More info on this URL Access method can be found on the same site, one level higher than the page mentioned above.