Showing posts with label viewing. Show all posts
Showing posts with label viewing. Show all posts

Friday, March 9, 2012

Possible to render direct to PDF instead of viewing the report on a webpage?

Is it possible to to render direct to PDF when viewing the report url?

Hello,

Try adding the part in red to your URL:

http://ServerName/Reportserver/Pages/Report.aspx?ItemPath=%2fReportPath%2fReportName&rs:Command=Render&rs:Format=PDF

Hope this helps.

Jarret

|||

Will check that out in the beginning of the next week.

Thanks!!!

|||

Jarret wrote:

Hello,

Try adding the part in red to your URL:

http://ServerName/Reportserver/Pages/Report.aspx?ItemPath=%2fReportPath%2fReportName&rs:Command=Render&rs:Format=PDF

Hope this helps.

Jarret

Jarret is right, however it is better not to render from http://servername/reportserver/?/ReportPath/ReportName&rs:Format=PDF

The server will automatically redirect you to the ./Pages/Report.aspx part, but that is really an implementation detail and could change in the future.

|||

Hi

I′ve tested to do it like this and it works if parameters needed for the report are passed in the the url-string.

The problem is if you would like the user to write in a parameter (eg. orderno) to the report, this solution won′t work.

It seems like it have to go through the standard way, via the HTML-page if orderno needs to be set.

Any Ideas how to solve this?

|||

private void CreatePDF()

{

try

{

Microsoft.Reporting.WebForms.Warning[] warn;

string[] streamids;

string mimeType = "application/pdf";

string encoding = string.Empty;

string extension = string.Empty;

byte[] byteViewer;

byteViewer = ReportViewerMain.ServerReport.Render("PDF", null, out mimeType, out encoding, out extension, out streamids, out warn);

Response.Buffer = true;

Response.Clear();

Response.ContentType = "application/pdf";

Response.AddHeader("content-disposition", "inline; filename=myReport.pdf");

Response.BinaryWrite(byteViewer);

Response.Flush();

Response.End();

streamids = null;

byteViewer = null;

}

catch (Exception ex)

{

ExceptionManager.Sys(ex);

}

}

|||

Hi there

Should I put this code in custome code? Any references needed?

Wednesday, March 7, 2012

Possible to assign a value to a textbox?

Hi,
Is it possible to assign a value to a textbox when viewing reports, depending on certain values of the fields. E.g if Fields!Month.Value = Parameters!Month.Value, i want to display some message in the textbox.
Hi eeyore21
It is possible unless I'm not understanding the question correctly. Try this:
Select the textbox properties. In the 'Value: ' property select 'Expression' (button next to textbox)
type in '=IIF( Parameters!PamaterName.Value = Fields!FieldName.Value,"Print this if true","Print this if False")'

whereParameters!PamaterName.Value - this is the parameter value which you want to compare to Fields!FieldName.Value ( dataset field name)

In your case it would be :=IIF(Fields!Month.Value = Parameters!Month.Value,"IT IS TRUE DO SOMETHING","NOT TRUE DO SOMETHING ELSE")'