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

WinForms RefreshReport(): Telerik.Reporting.HtmlRendering2

2 Answers 133 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Testuser
Top achievements
Rank 1
Testuser asked on 07 Aug 2012, 08:52 AM
Language: C#, VS2010
First, I tried to report in a standalone project (WinForms) zu display a preview with ReportViewer and it worked.
Then I added the same files and references to a bigger solution (WinForms also) and called the PreviewDialog like before in the standalone project and I generates also the reportdocument, but this time it prompt me first 3 messages with the caption Error! (Fehler!), but only once during the runtime.

Heres the method that starts the ReportRefresh-Method()

/// <summary>
/// Barcodes generieren und anzeigen. Legt zusätzlich den angezeigten Titel fest und stellt Enabled auf true.
/// </summary>
/// <param name="titel">Anzuzeigender Titel</param>
/// <param name="barcodeItems">Zu erstellende Barcodes</param>
/// <param name="target">ReportViewer, der als Ausgabe verwendet werden soll</param>
public static void DisplayBarcodes(Telerik.ReportViewer.WinForms.ReportViewer target, string titel, IEnumerable<ReportItem> barcodeItems)
        {
            DefaultUserPresentationReport templateOfReport = null;
            InstanceReportSource instance = null;
            bool newReport = false;
 
            if (target.ReportSource != null)
            {
                instance = (target.ReportSource as InstanceReportSource);
                if (instance != null && instance.ReportDocument != null)
                {
                       templateOfReport = instance.ReportDocument as DefaultUserPresentationReport;
                }
            }
            else
            {
                templateOfReport = new DefaultUserPresentationReport();
                newReport = true;
            }
 
            templateOfReport.DocumentName = titel;
 
            //Aufgrund der Performance, werden die Bilder an die tatsächliche Größe angepasst
            // Zielgröße bestimmen
            Size sizeOfItemImage_Pixel = templateOfReport.ThumbnailSize;
 
            // A list with barcodeItems and an image
            List<ReportItem> barcodeListe = barcodeItems.ToList();
 
            // Resize images to preview size
            for (int i = 0; i < barcodeListe.Count; i++)
            {
                if (barcodeListe[i].Bild != null)
                {
                    // wrong size images only!
                    if (barcodeListe[i].Bild.PhysicalDimension.Width != sizeOfItemImage_Pixel.Width || barcodeListe[i].Bild.PhysicalDimension.Height != sizeOfItemImage_Pixel.Height)
                    {
                        var newImageForReport = new Bitmap(barcodeListe[i].Bild, sizeOfItemImage_Pixel);
 
                        // free old ram space!
                        barcodeListe[i].Bild.Dispose();
                        barcodeListe[i].Bild = null;
 
                        barcodeListe[i].Bild = newImageForReport;
                    }
                }
            }
 
            target.Enabled = true;
            // set report title
            templateOfReport.Title = titel;
 
            // set source of template report to items
            templateOfReport.SetItemsToPrint(barcodeListe);
 
            if (newReport)
            {
                target.ReportSource = new InstanceReportSource() { ReportDocument = templateOfReport };
            }
            else
            {
                target.ReportSource = instance;
            }
 
            // render start!
            fromMethod = true;
 
            // ! During this step suddenly 3 messages prompt
            target.RefreshReport();
 
            fromMethod = false;
        }

Number
#1) Telerik.Reporting.HTMLRendering2.HtmlReport.resources
#2) Telerik.Reporting.HTMLRendering2.HtmlReportInteractive.resources 
#3) Telerik.Reporting.HTMLRendering2.MHTMLReport.resources

The type Telerik.Reporting.HTMLRendering2.HtmlReport.resources could not be solved
Sender: MyApplication.host.exe
No context avaible

The refrerences the first project needed were:
Telerik.Reporting
and Telerik.ReportViewer

Note:
No Error-Event is firing before these messages are shown and I only want to display the document report and export to pdf.
So it does not have any connection the a Telerik.Reporting.HtmlRendering2 namespace.

Does someone had also this problem and a solution, and why are these message shown in the second, but not in the first standalone project?

Once again, there are all the same files and references in both projects.

I added the messages to one image as attach-files.

System: Windows 7, VS2010, C#

Solution structure second projects:

Solution Folder
   First Start Project X
        App.config
   Project Y
   Project Z ...
   Report Project
        Refrences to Telerik.Reporting, Telerik.ReportViewer.WinForms (both Version: 6.1.12.611, Description: Q2 2012)
        ProjectFolders with ReportPreviewForm

2 Answers, 1 is accepted

Sort by
0
Testuser
Top achievements
Rank 1
answered on 13 Aug 2012, 08:34 AM
I solved it with Telerik-Support help.

These messages does not appear in release mode.
0
Hrisi
Telerik team
answered on 13 Aug 2012, 09:18 AM
Hi,

You can disable these messages in debug mode as well by switching off the First chance exceptions.

Greetings,
Hrisi
the Telerik team

BLOGGERS WANTED! Write a review about Telerik Reporting or the new Report Designer, post it on your blog and get a complimentary license for Telerik Reporting. We’ll even promote your blog and help bring you a few fresh readers. Yes, it’s that simple. And it’s free. Get started today >

Tags
General Discussions
Asked by
Testuser
Top achievements
Rank 1
Answers by
Testuser
Top achievements
Rank 1
Hrisi
Telerik team
Share this question
or