This is a migrated thread and some comments may be shown as answers.

'ReportProcessor' is ambiguous in namespace

1 Answer 71 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Yilmaz
Top achievements
Rank 1
Yilmaz asked on 20 Oct 2010, 10:16 AM
Hi;
(Use 2009.Q1)
i am writing my own web browser. And from that browser, i try to export a report to pdf. But when you click on the Export functionality, it opens the export operation on Internet Explorer (a different web browser of course...). And because the instance ids of my own web browser and internet explorer's are different, exporting fails. Now that, i need to export the report on the same page by writing code behind a button control or by changing the functionality of WebReportViewer to export the report to the _self window.

First of all, i am using a code snippet that would display the report in the same page with my web browser (by implementing a button control's event). The code snippet is:

http://www.telerik.com/help/reporting/faq-display-pdf-browser.html
Sub ExportToPDF(ByVal reportToExport As Telerik.Reporting.Report)    
    Dim reportProcessor As New ReportProcessor() 
    Dim result As RenderingResult = reportProcessor.RenderReport("PDF", reportToExport, Nothing
  
    Dim fileName As String = result.DocumentName + ".pdf"   
    Response.Clear()    
    Response.ContentType = result.MimeType    
    Response.Cache.SetCacheability(HttpCacheability.Private)    
    Response.Expires = -1    
    Response.Buffer = True    
    Response.AddHeader("Content-Disposition", String.Format("{0};FileName=""{1}""", "attachment", fileName))    
    Response.BinaryWrite(result.DocumentBytes)    
    Response.End()    
End Sub

Although i have imported Telerik.Reporting and Telerik.Reporting.Processing libraries, the compiler tells me that "ReportProcessor" is ambigious in the namespace Telerik.Reporting.Processing. Why do i get this error?

As a second question, i tried to open the exported sheet in the same window by using WebReportViewer with _self directive. But i failed again because of the different instance ids of web browsers...

Any ideas about exporting the report to _self window would be appreciated!.
Thanx

1 Answer, 1 is accepted

Sort by
0
Steve
Telerik team
answered on 20 Oct 2010, 04:57 PM
Hello Yilmaz,

We cannot really help you with "your own browser" issue as it does not fall in the support domain for our product. As for the 'ReportProcessor' is ambiguous problem, the code in the referenced article is valid for versions after Q2 2009. For the Q1 version you're using, you should refer to the corresponding documentation installed along with the product. Namely the code is:

Sub ExportToPDF(ByVal reportName As String, ByVal reportToExport As Telerik.Reporting.Report)
 Dim mimeType As String = String.Empty
 Dim ext As String = String.Empty
 Dim encoding As Encoding = Encoding.[Default]
 Dim reportBytes As Byte() = ReportProcessor.Render("PDF", reportToExport, Nothing, mimeType, ext, encoding)
 Dim fileName As String = reportName + ".pdf"
 Response.Clear()
 Response.ContentType = mimeType
 Response.Cache.SetCacheability(HttpCacheability.[Private])
 Response.Expires = -1
 Response.Buffer = False
 Response.AddHeader("Content-Disposition", String.Format("{0};FileName=""{1}""", "attachment", fileName))
 Response.OutputStream.Write(reportBytes, 0, reportBytes.Length)
 Response.[End]()
End Sub


Greetings,
Steve
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
General Discussions
Asked by
Yilmaz
Top achievements
Rank 1
Answers by
Steve
Telerik team
Share this question
or