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

Windows Form Report Not Render

4 Answers 82 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Alfred
Top achievements
Rank 1
Alfred asked on 16 Jun 2010, 08:45 AM
Version: Q3 2009
Visual Studio 2005 + windows 7

I have a report viewer1 in a form.  I load a report to the report viewer.  The subLoadReportHeader is just to load heading from a database. eg Report Title, etc.
Dim myReport1 As New someReport  
myReport1.oTable = oTable  
myReport1.subLoadReportHeader()  
Me.ReportViewer1.Report = myReport1  
 
 
 

In the someReport, I use NeedDataSource to bind the data.


Private Sub someReport_NeedDataSource(ByVal sender As ObjectByVal e As System.EventArgs) Handles Me.NeedDataSource  
        Me.DataSource = oTable  
End Sub 

So the report can only display with the heading but not the details.  I need to click the refresh button in the report viewer to refresh so as to display the details.

What is wrong?  Thanks.

4 Answers, 1 is accepted

Sort by
0
Steve
Telerik team
answered on 16 Jun 2010, 09:11 AM
Hi Alfred,

As outlined in our documentation in the Using the NeedDataSource event to connect data help article, you should use the processing data item i.e.:

Private Sub someReport_NeedDataSource(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.NeedDataSource 
  TryCast(sender, Telerik.Reporting.Processing.Report).DataSource = oTable
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.
0
Alfred
Top achievements
Rank 1
answered on 16 Jun 2010, 04:11 PM
It is the same.

If I add 
Dim myReport1 As New someReport  
myReport1.oTable = oTable  
myReport1.subLoadReportHeader()  
Me.ReportViewer1.Report = myReport1
Me.ReportViewer1.RefreshReport()  
 

then the report can generate. 
But I think there must be something wrong.  Since if I add:

Me.ReportViewer1.Report = myReport1  
Me.ReportViewer1.RefreshReport()  
ExportToPDF() 

The ExportToPDF:
Dim reportProcessor As New ReportProcessor()  
Dim result As RenderingResult = reportProcessor.RenderReport("PDF", ReportViewer1.Report, Nothing)  
Dim fs As New System.IO.FileStream(stFile, IO.FileMode.Create)  
fs.Write(result.DocumentBytes, 0, result.DocumentBytes.Length)  
fs.Flush()  
fs.Close()  
 

The export function does not work.  Since when reportProcessor renders the report again, there is no report generated (no refresh button click.)

My target is simple, once the report is created at front end, a copy must be saved at server.
0
Alfred
Top achievements
Rank 1
answered on 16 Jun 2010, 07:24 PM
After trial and error, I found that:
1. I need to have the report in separate class library.  The Reportviewer loads normally.
2. Export the report to pdf programmatically is not possible.
3. When the reportviewer renders the report, I try to export the report to pdf by clicking the button, but, it shows the error:
object reference not set to an instance of object
3. Export to image seems to be normal programmatically or clicking on the export button.

Methinks the error is probably due to the Telerik Reporting does not suppot Windows 7 and Acrobat writing function. 

How to fix that?

Thanks.

(2010-06-21) Sorry.  My Windwos 7 is 64 bit.
0
Steve
Telerik team
answered on 22 Jun 2010, 01:47 PM
Hello Alfred,

We've noticed that in your specific scenario, the reporting engine is unstable. To make this work properly, please invoke the ExportToPdf() method before the RefreshReport i.e.:

....
Me.ReportViewer1.RefreshReport()
ExportToPDF()
....

Kind regards,
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
Alfred
Top achievements
Rank 1
Answers by
Steve
Telerik team
Alfred
Top achievements
Rank 1
Share this question
or