Showing posts with label print. Show all posts
Showing posts with label print. Show all posts

Tuesday, March 20, 2012

Repeating report

I want to do the following with RS:
I have a invoice that I want to print three times and at the end of the
report I want to print a letter refering the invoices. I could do that making
2 reports, calling the first with three copies for the invoices and the
second report would be the letter.
But that doesn't seems to be a pretty way to do things.
Anybody can help me'
Thanx.You could do this with a report and subreport. Make a report for your
invoice and an report for your letter. Then add to your letter report: two
subreports that both point to the invoice report. It should optimize pretty
well.
--
Cheers,
'(' Jeff A. Stucker
\
Business Intelligence
www.criadvantage.com
---
"TheRSBeginner" <TheRSBeginner@.discussions.microsoft.com> wrote in message
news:9CC3661E-F5D1-4D9E-8CF9-7F918403EB1A@.microsoft.com...
>I want to do the following with RS:
> I have a invoice that I want to print three times and at the end of the
> report I want to print a letter refering the invoices. I could do that
> making
> 2 reports, calling the first with three copies for the invoices and the
> second report would be the letter.
> But that doesn't seems to be a pretty way to do things.
> Anybody can help me'
> Thanx.
>

Monday, March 12, 2012

Repeating Footer on every page when printing

Using RS2005, but the same thing happened on RS2000.
This report has 4 matrices and 4 charts which causes the report to print on
3 pages of 11in by 8.5in paper (landscape). I have a Footer that references a
textbox in the body of the report, but when the report is printed, the footer
only appears on the last page. The textbox that the footer is referring to
has an aggregate expression in it such as First(Fields!REVIEW_MONTH.Value,
"Datasetname"). The Footer has the following expression: "= ReportItems!textbox53.value". I have tried everything including vertically
stretching textbox53 across all of the objects in the body. This almost
worked because the footer did appear on pages 1 & 2, but not page 3.
Can someone please help me. Thanks.
--
-RB
:)FYI - I found the solution by contacting MSN support.
The key is to create a hidden report parameter. In the default values
section, use "From Query" and select the dataset and the field that is
desired to be displayed in the footer. Then just reference the Hidden
parameter within a Textbox of the Page Footer. Now, the Page Footer will
repeat on every page of the report regardless of the number of different data
regions. The report parameter is treated like a Global variable in this
scenario.
--
-RB
:)
"capricorn" wrote:
> Using RS2005, but the same thing happened on RS2000.
> This report has 4 matrices and 4 charts which causes the report to print on
> 3 pages of 11in by 8.5in paper (landscape). I have a Footer that references a
> textbox in the body of the report, but when the report is printed, the footer
> only appears on the last page. The textbox that the footer is referring to
> has an aggregate expression in it such as First(Fields!REVIEW_MONTH.Value,
> "Datasetname"). The Footer has the following expression: "=> ReportItems!textbox53.value". I have tried everything including vertically
> stretching textbox53 across all of the objects in the body. This almost
> worked because the footer did appear on pages 1 & 2, but not page 3.
> Can someone please help me. Thanks.
> --
> -RB
> :)

Monday, February 20, 2012

Rendering the ASP.NET local report directly to PDF

Hi,

Since it is not possible to print from a local report in ASP.Net is there anyway to directly render to a PDF or hide the Local report rendering and automatically goto the PDF either in the web page or as a popup.

Thanks

Hi,

You can try this code:

string path = @."D:/Folder/MyFile.pdf";
WebClient client = new
WebClient();
Byte[] buffer = client.DownloadData(path);

if (buffer != null)
{
Response.ContentType = "application/pdf";
Response.AddHeader("content-length",buffer.Length.ToString());
Response.BinaryWrite(buffer);
}

Hope this helps,

Vivek

|||

Can this be done on a report on a server and a parameter is passed?

For example, when a button is clicked in a page, then it will pass a parameter to SSRS and then, in turn, returns a PDF file. (So there's no need for a report viewer)

I am not sure if its possible. Please advise. Thanks!

Lloyd

|||

Lloyd,

How are you returning the PDF file? SSRS will return only data (I do not have much experience in SSRS), I have worked on Crystal Reports and it exported idrectly to PDF.

If you have data then you can format and show it to PDF. You can change the Response.ContentType as I mentioned before or use some tools like:

http://www.websupergoo.com/abcpdf-1.htm

Hope this helps,

Vivek

|||

Hi!

Thanks for the reply!

I'm thinking if this can be done. When I click the "Print" button, the report will be generated (PDF), and the standard pop up message of browser would come up, asking if the user would want to open or save the generated file.

Lloyd

|||

Lloyd,

You can first call the SSRS on the Print button click and then bind the resulting data to some data bound control, such as a DataGrid or GridView. After the bind, you can change the Response.ContentType property to "pdf". See my blog entry for details:

http://geekswithblogs.com/vivek

You can also try an Open Source PDF Report Server Control:http://sourceforge.net/projects/npdf/

Hope this helps,

Vivek

|||

Try this:

Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
'CODEGEN: This method call is required by the Web Form Designer
'Do not modify it using the code editor.
InitializeComponent()

Dim rs As New msfirm_db_stl.ReportingService
'rs.Credentials = System.Net.CredentialCache.DefaultCredentials
Dim myCred As New NetworkCredential("Username", "Password", "Domain")
rs.Credentials = myCred

' Render arguments
Dim result As Byte() = Nothing
Dim reportPath As String = "/ImportedReports/" & Me.ReportName
Dim format As String = Me.ReportFormat
Dim historyID As String = Nothing
Dim devInfo As String = "<DeviceInfo><Toolbar>False</Toolbar></DeviceInfo>"

' Prepare report parameter.
Dim params() As String
params = Me.Parameters.Split("&")
Dim nParams As Integer = 0
Dim parameters() As msfirm_db_stl.ParameterValue
If params.Length > 0 And Me.Parameters <> String.Empty Then
ReDim parameters(IIf(params.Length > 0, params.Length - 1, 0))
For Each s As String In params
If s <> String.Empty Then
Dim keyval() As String = s.Split("=")
parameters(nParams) = New msfirm_db_stl.ParameterValue
parameters(nParams).Name = keyval(0)
parameters(nParams).Value = keyval(1)
nParams += 1
End If
Next
End If

Dim testparms() As msfirm_db_stl.ReportParameter = rs.GetReportParameters(reportPath, historyID, False, Nothing, Nothing)
If (testparms.Length.ToString) <> (nParams.ToString) Then
Response.Redirect(ConfigurationSettings.AppSettings.Get("ReportServerURL") & "?%2fImportedReports%2f" & Me.ReportName & "&rs%3aCommand=Render&rs%3aFormat=HTML4.0&rc%3aToolbar=True&rc%3aJavaScript=True")
End If

'Set Web Service user credentials
Dim credentials As msfirm_db_stl.DataSourceCredentials() = Nothing
Dim showHideToggle As String = Nothing
Dim encoding As String
Dim mimeType As String
Dim warnings As msfirm_db_stl.Warning() = Nothing
Dim reportHistoryParameters As msfirm_db_stl.ParameterValue() = Nothing
Dim streamIDs As String() = Nothing
Dim sh As New msfirm_db_stl.SessionHeader
rs.SessionHeaderValue = sh

Try
result = rs.Render(reportPath, format, historyID, devInfo, parameters, credentials, showHideToggle, encoding, mimeType, reportHistoryParameters, warnings, streamIDs)
sh.SessionId = rs.SessionHeaderValue.SessionId
Catch ex As SoapException

End Try
'' Write the contents of the report to an MHTML file.
Try
Response.Buffer = True
Select Case Me.ReportFormat
Case "EXCEL"
Response.ContentType = "application/vnd.ms-excel"
Case "HTML4.0", "HTMLOWC"
Response.ContentType = "text/html"
Case "PDF"
Response.ContentType = "Application/PDF"
End Select

'Response.AddHeader("Content-Disposition", "attachment;filename=" & Me.ReportName & ".pdf")
Response.BinaryWrite(result)
Catch ex As Exception

End Try
End Sub