Hello,
I am trying to get a SSRS 2005 report to print from my Visual Studio 2005 C++ application without using the ReportViewer to preview it first. What I have done is created a dll that I call into when I want to access a certain report and print it. While searching around on the internet I found an MSDN article about printing a report without previewing and it had an example in C# code. So I used that as a guide for my C++ code but I am still having problems with rendering the report properly so it can be printed. When I try to render a report using the "Image" format, my streamid string is empty but the byte array that the render routine returns is not. Here is the code I am using, what could be the problem here?
Note: m_Streams is define elsewhere as
array<String^>^ m_Streams = gcnew array<String^>(10);
Private Function MoveToPage(ByVal page As Int32) As Boolean
' Check to make sure that the current page exists in
' the array list
If Nothing Is Me.RenderedReport(m_currentPrintingPage - 1) Then
Return False
End If
' Set current page stream equal to the rendered page
m_currentPageStream = New MemoryStream(Me.RenderedReport(m_currentPrintingPage - 1))
' Set its postion to start.
m_currentPageStream.Position = 0
' Initialize the metafile
If Not Nothing Is m_metafile Then
m_metafile.Dispose()
m_metafile = Nothing
End If
' Load the metafile image for this page
m_metafile = New Metafile(CType(m_currentPageStream, Stream))
Return True
End Function
Private Function MetafileCallback(ByVal recordType As EmfPlusRecordType, ByVal flags As Integer, ByVal dataSize As Integer, ByVal data As IntPtr, ByVal callbackData As PlayRecordCallback) As Boolean
Dim dataArray As Byte() = Nothing
' Dance around unmanaged code.
If data <> IntPtr.Zero Then
' Copy the unmanaged record to a managed byte buffer
My Requirement is to dirctly Print the SSRS Report without using Reportviewer. If anybody know How to Print Report without using Reportviewer, please let me know asap.
1. I would like to print one of my database to a printer, how can I do that? 2. I would like to transfer one of my database to Microsoft Excel 97/2000, how can I do that?
The service pack for Visual Studio has fixed the problem when I print my report from VS, however when I deploy and print my reports from the SSRS website they are still incorrect.
My SSRS server is running SQL 2005 with service pack 2 installed and the 9.00.3152 9333097 Cumulative hotfix package (build 3152) for SQL Server 2005 Service Pack 2 also applied.
I find it hard to believe the problem was fixed in the developer tool but NOT in the client tool?
How can I develop reports when the output from the developer tool is different to the output from the client tool?
For example I specify a box to be 5cm wide, and when printed from visual studio it is 5cm wide, but when printed from the SSRS website it is not 5cm wide!
Very strange problem here with Reporting Services SQL 2005 SP1 with latest patch KB 918222 on Windows Server 2003 SP1. The clients PC are Windows XP both SP1 and SP2 and that's not affecting our problems.
When my default printer is set to the "Printer 1" (HP LaserJet 9000), when i look a report's into the Report Viewer and i click on the print button (printer image button that use the ActiveX RSClientPrint), i let the default printer to "Printer 1". In this case, the report is printed correctly.
Again with my default printer set to "Printer 1", i look the same report into the Report Viewer and i click on the print button again. This time i select another printer "Printer 2" (an older HP LaserJet 8000 DN) and the report is printed correctly.
Now the problem is when i set the "Printer 2" as default printer. If i go to the Report Viewer and i click on the print button for the same report that was printed correctly before, now the report seem's to be ok into the preview before i print, but when i send the job to the "Printer 2" the report require a unknown paper format, so the "Printer 2" ask paper into the tray 1 (manual feed) and the result of the printed report is not good. The right and the bottom seem's to be cutted. I tried to reduce the report dimension without good results. The report is always cutted to right and bottom and the printer ask paper into the tray 1 (unknown paper).
Is't not the end, if i print the same report on the "Printer 1" when the default printer is "Printer 2", the report is printed correctly.
I have tried to use another printer than the "Printer 2" to see if the problem is the printer. I tried the "Printer 3" (HP LaserJet 9050) as default printer, i print the report on this one and i have the same problem than with the "Printer 2". And if i set "Printer 1" as default and i print on the "Printer 3" the report is printing correctly.
For all the printers i have the latest drivers. The same problem is occuring on all other PC other than mine.
We have checked the printers configuration and all seem's to have the same configuration.
Can this be a bug with the ActiveX RSClientPrint or what ?
Note that all previews before printing are good with all printers, but with the "Printer 2" and "Printer 3" set to default, the printed report was not the one i saw into the Preview.
Below a link to a sample report that we have. All our reports have the same global dimensions.
So I have been asked by our sustainability person to create report from our printing data that actually shows the number of pieces of paper used. This is easy enough for single-sided printing, but when printing in duplex the software does not take into account that 3 printing pages actually equates to 2 pieces of paper. I know this sounds simple, but say I have a print job record that looks like this:
This is a print jobs that if done correctly is actually 21 pages( duplex printing). If the job is say total_pages =5 I cant just divide by 2 because its actually using 3 pieces of paper ( yes they are wanting this data don't ask why). How can I adjust some sql to accurately depict 5 pages, front and back, as 3 pieces of paper?
I have deployed a report that is configured for landscape printing. It does print in landscape, however, only the first seven columns appear on the first page and the other five columns appear on the next page. Is there a method, like in print preview setup in MS Excel, where we can scale down the print (like to 80%) so all columns appear on each page?
Hi all I am using local reports.(.rdlc files) My requirement is when the user selects some options in the form and click on Submit buttion,He should get report in PDF format directly.Is it possible?if possible give me some example code.No need to preview in general format. Help me. Regards.
It appears to work fine on my end however on my clients end, whenever they try to print a report that displays perfectly within the report viewer to their printer by selecting the printer button in the report it never ends up printing.., however if they go into printer setup and change the page range to print from all pages to just maybe one page and then select the print button it seems to print fine..
The printer seems to receive the information as the light flashes but no page kick out when all pages is selected to print..
I have a requirement to export certain data directly in csv format from the link thats in the report interface.
Though i am able to open new window report from the link by passing the needed parameter is there any way that we can directly open the excel from the link in data table in report..
i have a report that is on a subscription to my team members that i want to be rendered in the actual email that they open up. i do not want them to have to click on the pdf or excel attachment to open it up, i just want the content of the report to be in the email itself in outlook.
I have a .net application in this application I want to call directly subscription page of a perticular Report through URL. And i want to hide the header section too.Is it possible If not how can i provide this feature of subscription in my application
Is there a way to programmatically save a RS results into Excel format using the render method ?
I had read about that capability but I can't seem to find any sample code on how to do it. Is this a parameter that you have to set in the render method ?
I have a reporting viewer in a windows form that behaves very strange. When I open the form and run the report it shows up nicely in the report viewer. If I print the report it only prints one page. When i print the report a second time the whole report is printed. Next I'll change the report parameters and run the report, then it shows up nicely in the viewer, but when I print the report the first report is printed.
what i need to do for my project are as following:
a mobile user send data via GPRS to SQL server Database. then i need to have a method to detect while a particular table is being inserted. and then extract data from table construct a report dynamiclly. what should i do to achieve this goal? e.g. window application, store procedure or trigger ?
PS : client side is a mobile application developed using MCL. i don't in which way he will send all data to SQL server Database, so what i need to do is to monitor new data inserting.
2) how to auto generate and print report directly after record been inserted into the table ? Do i need to import report web service API ? if yes, which one? or i can use other methods e.g. predefine report control view in my window application, turn off pop-up menu while printing a report(I guess)
I was wondering if it was possible to call reporting server web service directly from my sql server stored procedure. The call that I need to make to reporting web service needs to generate the report in a PDF format.
Hi, I am having problems printing a new table we added to an existing report. When I preview the report in Visual Studio everything looks good. But when I click the print layout view button the "header" portion of the report shows on one page and the detail shows up on another. Has anyone seen this happen before?
i have created a report now i want to have the report print on one page instead of two pages which is doing now.how can i do that.i am using SSRS 2005. please help
I have a field on a Group Footer which is a Sum field based of an IIF statement.
Here it is.
=Sum(IIF(Fields!EXPR1.Value=2 and Fields!Type.Value=1,Fields!Quantity.Value,0))
If I do not use the AND, by by only checking on one field it works fine and it returns a result, however if I use the AND Operator I get the #Error when previewing the report.
Does anyone have any idea why this is happening. Any suggestion would help/
i have created a report now i want to have the report print on one page instead of two pages which is doing now.how can i do that.i am using SSRS 2005. please help
I have developed report(SSRS 2005) using Matrix control and Chart, on web in works good, but when user prints the report it cuts matrix and prints it on separate pages.
my requirement is to print every thing in a single page, no matter how much data i has. i tried landscape print (by changing width 11 and height to 8.5) but no result, does any one know the solution....?
I am running SSRS 2005, rendering reports locally using a report viewer. Rather than direct the viewer to an .rdlc file, I use an XMLDocument. A few of my reports have a large image in the background that needs to be invisible when the report prints. This was straightforward - I just use a report parameter and set the visible state of the image to the value of the parameter. The hard part is getting the report to print without an error.
Initially, I render the report with the following code:
End Sub This code works fine. I have hidden the print button on the report viewer, and to print, the user must press my button which runs the following code. Private Sub PrintReport()
Try _Param(0) = New Microsoft.Reporting.WinForms.ReportParameter("ImageVisible", "False") ShowReport()
ReportViewer1.PrintDialog()
Catch ex As Exception MsgBox(ex.ToString) End Try
End Sub Resetting the parameter and re-displaying the report works fine on its own. The PrintDialog method works fine on its own. When combined in the same Sub like this, I get the following error: "Operation is not valid due to the current state of the object". Does anyone know how I could get it to print without an error? I would be very grateful for any help.
I am rendering the report from remote server and I am displaying it. when I try to print the report from my application it is printin properly. but when I try to print it from IIS it is showing an error message that "No printers are Installed ". I did not specify any printer name in my application. How can I resolve this problem.
I have a report with pie and bar graphs, I have the paper size 16.54 x 11.69 for landsacpe, there are twelve graphs ,two placed side by side , and in the report manager, the appearence is perfect ,spread over six pages. I have Pagebreakatend True for all the graphs. The problem is with printing, on printing , the are tottaly misaligned,any tips are welcome
I have a report that only has one page when previewed but when it's printed there are two pages. This is a problem because I get two printed pages to my report with "1 of 2 pages" on the first page and "2 of 2 pages" on the second but there is only data on the first page and the second has header and footer but no data.
Is there a way to force the report to fit everything on one page? Or some other setting I am missing?
Hello Every one, we have reports, for that we are using Visual studio and report viewer. In Report viewer ,I Enabled print Option. While i tried to Print on HTML report from report viewer; I set Properties Landscae but the output is coming like Potrait. In my Rdl Interactive size Properties are width11 in and height 8.5 in why it is coming like Potrait size. can any one help me?
I have e-mails saved in a SQL database with all HTML formatting information. To remove all HTML formatting I craeted a function on the RS report:
Public Shared Function removeHtmlChar(ss) try Dim l as integer Dim i as integer Dim ch as string Dim x as integer Dim t as string t = "" l=len(ss) for i=1 to l ch=mid(ss,i,1) x=i if(ch="<") then x=i do while(mid(ss,x,1)<>">") x=x+1 loop else t=t & ch end if i=x next t = t.Replace("nbsp;"," ") removeHtmlChar = t catch removeHtmlChar = "" end try End Function
When I look at the report on the screen the report is showed correct. If I print or export the report it add a lot of line breaks in the e-mail text. Why does it not print it as it looks at the screen?
We have a report that prints correctly (in landscape) in the folder that is deployed to but the linked report in a different folder prints in portrait?