Home » VB.NetRSS

Reporting Services - Orientation Paper - Widht - Height

Hello Guys.
Have you seen that when the Widht is bigger than height, the SSRS change the orientation paper to landscape and in the another way it changes to portrait?
I have a paper who has more widht than height but I want to print it as portrait, because It will be printed in a continuos printer and the size of each paper is like an envelope.
I Have been looking for a solution on internet about this issue, but I havent found anything. 

For example. one Guy has the same problem and he wrote this: (I know is nothing about the printer, the problem is in the configuration of SSRS.) Thanks in advance!

I've come across what appears to be a bug in SSRS. If after reading this post you feel otherwise, please reply to this thread...

I am trying to use SSRS to print to a Dymo LabelWriter 400 printer. This is a specialized label printer that prints one label to a page. The label paper I am using 2-1/2 inches by 1-1/2 inches. The Dymo printer driver prints portait layout as being the 2-1/2 inches width and 1-1/2 inches height. I assume that is because the paper rolls through the printer that way and labels normally are printed with more width than height.

Other software programs I use to print to this printer handles it properly (Microsoft Word, Microsoft Office Document Imaging, Dymo Label software). However, SSRS seems to assume that portrait layout must mean paper height > width, as there is no explicity setting in SSRS to for page layout. The result is that no matter how I layout my SSRS report (e.g., switch width-height values, use tb-rl to rotate text), SSRS makes the final decision on whether it is portrait or lanscape. And in this case of the Dymo printer, it always sets it to the opposite of what it should be. Changing the printer settings (whether default or whether in print dialog) does not correct it.

Although assuming that portrait layout must mean paper height > width may seem to make logical sense, not every printer works that way; and other software programs (including Microsoft Office) do not make that assumption. It seems that SSRS and/or RDL spec should allow one to explicitly set portrait/landscape setting and not care about width-height ratio. It should be left to the printer and printer driver to decide.

Have other people come across this issue, either with Dymo printer or in other context? Were they able to find a workaround?

 

7 Answers Found

 

Answer 1

Hi smoncayo,

You are right. SQL Server Reporting Services print  a report in landscape  or portrait  based on the difference between the width and height.
If the width is larger than the height, the report will printed  in landscape, otherwise it will be printed in portrait.

In order to work around the issue  you mentioned, we can implement our customized application to render the report using Reporting Services web service API, and then use PrintDocument .NET object to print the report in portrait orientation.'

Or, please submit a wish at http://connect.microsoft.com/sql

For more information, please see:
ReportExecutionService.Render Method: http://msdn.microsoft.com/en-us/library/reportexecution2005.reportexecutionservice.render.aspx
PrintDocument Class: http://msdn.microsoft.com/en-us/library/system.drawing.printing.printdocument.aspx

If you have any more questions, please feel free to ask.

Thanks,
Jin Chen


Jin Chen - MSFT
 

Answer 2

Hello Jin Chen. Thanks for your answer.

I'll be honest.
I have no idea about ReportExecution2005. 
I know is a kind of web services  from reporting  services but I think this services is not already deployed in my server. (I am using Reporting services 2008).
I tried to search the information on internet  but i feel that I am getting more confuse.

I just dont know how to start. and I am very worried about that.
Could you please help me with an step by step?

I really apreciate your help.

smoncayo

 

 

Answer 3

Hello.

Any help regarding this issue?
I do apreciate your help guys.

smoncayo.

 

Answer 4

Hi Smoncayo,

Reporting Services 2008 has the same end points with Reporting Services 2005, which means ReportExecution2005 is available in Reporting Services 2008 too.

There is a sample in the article I posted before. What we just need to do is add a web service reference.

There is a Walktrhough, that will help to understand:
http://msdn.microsoft.com/en-us/library/ms169926.aspx

Thanks,
Jin Chen

 

Answer 5

Hello Jin-

Thanks for your Answer.

I already added my Service Reference. But when I tried to use the code that you gave me, 

the class ReportExecutionService rs = new ReportExecutionService() could not be found.

I am forgeting something?

I added my code. Thanks again!

 

using

 

 

Q10.Agatha.Business;

using

 

 

Q10.Agatha.Business.DataSets;

using

 

 

Q10.Agatha.DataAccess;

using

 

 

System.Drawing;

using

 

 

System.Drawing.Imaging;

using

 

 

System.Web.Services.Protocols;

using

 

 

Q10.Agatha.Academico.Web.myServiceReference;

namespace

 

 

Q10.Agatha.Academico.Web.Utilities.Reports

{

 

 

publicclassclsServiceReference

{

 

 

publicvoid ObtenerWebReference()

{

ReportExecutionService rs =

 

new ReportExecutionService(); // could not be found

rs.Credentials = System.Net.

 

CredentialCache.DefaultCredentials;

rs.Url =

 

"http://myserver/reportserver/ReportExecution2005.asmx";

 

 

// Render arguments

 

 

byte[] result = null;

 

 

string reportPath = "/AdventureWorks Sample Reports/Employee Sales Summary";

 

 

string format = "MHTML";

 

 

string historyID = null;

 

 

string devInfo = @"<DeviceInfo><Toolbar>False</Toolbar></DeviceInfo>";

 

 

// Prepare report parameter.

 

 

ParameterValue[] parameters = newParameterValue[3];

parameters[0] =

 

newParameterValue();

parameters[0].Name =

 

"EmpID";

parameters[0].Value =

 

"288";

parameters[1] =

 

newParameterValue();

parameters[1].Name =

 

"ReportMonth";

parameters[1].Value =

 

"6"; // June

parameters[2] =

 

newParameterValue();

parameters[2].Name =

 

"ReportYear";

parameters[2].Value =

 

"2004";

Web.myServiceReference.

 

DataSourceCredentials[] credentials = null;

 

 

string showHideToggle = null;

 

 

string encoding;

 

 

string mimeType;

 

 

string extension;

Web.myServiceReference.

Warning[] warnings = null;

 

Warning[] warnings = null;

Warning[] warnings = null;

 

ParameterValue[] reportHistoryParameters = null;

 

 

string[] streamIDs = null;

ExecutionInfo execInfo =

 

new ExecutionInfo(); // could not be found

ExecutionHeader execHeader =

 

new ExecutionHeader();// could not be found

rs.ExecutionHeaderValue = execHeader;

execInfo = rs.LoadReport(reportPath, historyID);

rs.SetExecutionParameters(parameters,

 

"en-us");

 

 

String SessionId = rs.ExecutionHeaderValue.ExecutionID;

 

 

Console.WriteLine("SessionID: {0}", rs.ExecutionHeaderValue.ExecutionID);

 

 

try

{

result = rs.Render(format, devInfo,

 

out extension, out encoding, out mimeType, out warnings, out streamIDs);

execInfo = rs.GetExecutionInfo();

 

 

Console.WriteLine("Execution date and time: {0}", execInfo.ExecutionDateTime);

}

 

 

catch (SoapException e)

{

 

 

Console.WriteLine(e.Detail.OuterXml);

}

 

 

// Write the contents of the report to an MHTML file.

 

 

try

{

 

 

FileStream stream = File.Create("report.mht", result.Length);

 

 

Console.WriteLine("File created.");

stream.Write(result, 0, result.Length);

 

 

Console.WriteLine("Result written to the file.");

stream.Close();

}

 

 

catch (Exception e)

{

 

 

Console.WriteLine(e.Message);

}

}

 

}

}

 

Answer 6

Hi smoncayo,

You may try to import the ReportingService namespace first to fix the issue.

For example:
using myNamespace.MyReferenceName;

The myNamespace is the namespace of the project, and the MyReferenceName is the reference name of the ReportExecution service.

Thanks,
Jin Chen

 

Answer 7

Hello Jin.

Yes, Its rare cause I already added the namespace.

It's 

using

 

 

Q10.Agatha.Academico.Web.myServiceReference;

But, still cant recognice that. 

 

ReportExecutionService rs = new ReportExecutionService(); // could not be found

Any other suggestion?

Thanks for your help and patience.

smoncayo 

 
 
 

<< Previous      Next >>


Microsoft   |   Windows   |   Visual Studio   |   Follow us on Twitter