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

Exporting ReportBook

7 Answers 209 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Michael Hilgers
Top achievements
Rank 1
Michael Hilgers asked on 21 Jun 2010, 03:27 PM
Hi everyone!

I've created a ReportBook with 3 reports in it (created runtime, not in designer).

In preview (ReportViewer Control, WinForm) everything renders as expected, all 3 reports are displayed.

But when i export this as PDF/Excel ... (it's no difference if i'm doing this from code or with the ReportViewer Export Button) i only get the last of the 3 reports as export result, first and second report are gone to /dev/null ....

I've tried this with different reports, always the same result.

I also checked if the input for the ReportProcessor is correct, 3 Reports are in the reportBook when passed to the RenderReport function.

We are using the latest version 2010.1.423.

So, anyone any idea? =)

Regards,
Michael


7 Answers, 1 is accepted

Sort by
0
Steve
Telerik team
answered on 22 Jun 2010, 06:34 AM
Hello Michael,

Unfortunately the provided information is insufficient for us to determine what might be the cause for the issue and we have not been able to reproduce it on our end.
In fact we have a ReportBook demo where reports are set in code as well - you can open the Visual Studio examples and test/review the provided sample.
If still having problems, we would appreciate if you provide us with a sample runnable project which replicates the problem. You can open a support ticket and attach the project there - once we review it, we would be able to provide more info on the matter.

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
0
Andrea Rapuzzi
Top achievements
Rank 1
answered on 30 Jun 2010, 05:15 PM
Hello Steve,

I have the same problem, when I print the report book from the report viewer I get all the reports properly, but when I export them in PDF or any other format I get only the last report in the book. All the reports added to report book programmatically are new instance of the same report with different datasource. At the moment is the best choice for my needs, but this is the last one to solve for me.

Do you have any suggestion ?

Thanks a lot !

Andrea
0
Michael Hilgers
Top achievements
Rank 1
answered on 01 Jul 2010, 07:25 AM
Hi Andrea,

i discovered the cause of the problem:

The option "PageNumberingStyle.ResetNumberingAndCount" for all reports in the reportBook in combination with the textBox content "= PageNumber + " of " + PageCount" for displaying the  page order etc. causes the malfunction of the exporter.

I already reported this bug to Telerik and they will fix it in a future Version, but said that there is no workaround at this time. So you can just avoid the page formatting option described above.

Best Regards,
Michael



0
Andrea Rapuzzi
Top achievements
Rank 1
answered on 01 Jul 2010, 08:07 AM
Hi Michael,

thanks for your reply !!

Unfortunatly the page numbering is a requirement of my customer, so I have to remove the export option from the report viewer ...

Best Regards.

Andrea
0
Robert
Top achievements
Rank 1
answered on 24 Aug 2010, 11:46 PM
I used the following to create a Reportbook to send the results to pdf and mhtlm files then e-mail the results to my users
The PDF file is perfect however the html is only showing the first report :(
I tried looping thru the reports to send the results to the html stream without success.

Code Follows

 

using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
using BSAReports;
using Telerik.Reporting;
using System.Net.Mail;
  
namespace BSAReportsMonday
{
    class Program
    {
        static void Main(string[] args)
        {
  
            try 
            {
  
                string date = DateTime.Today.ToString("yyyyMMdd");
                string ReportPath = Properties.Settings.Default.ReportPath;
                ReportBook reportBook = new ReportBook();
  
                reportBook.Reports.Add(new NewCustomer());
                reportBook.Reports.Add(new Inactiveprofiles());
                reportBook.Reports.Add(new AccountRequiringProfiles());
  
  
  
                Telerik.Reporting.Processing.ReportProcessor reportProcessor
                    = new Telerik.Reporting.Processing.ReportProcessor();
                Telerik.Reporting.Processing.RenderingResult result = reportProcessor.RenderReport("PDF", reportBook, null);
  
  
                MemoryStream theMemStream = new MemoryStream(result.DocumentBytes);
  
                FileStream fs = File.Open(string.Format("{0}\\BSA_MondayReports_{1}.PDF", ReportPath, date), FileMode.Create);
                theMemStream.WriteTo(fs);
                fs.Close();
                theMemStream.Close();
  
                fs = File.Open(string.Format("{0}\\BSA_MondayReports_{1}.MHTML", ReportPath, date), FileMode.Create);
  
  
                //foreach (Report rep in reportBook.Reports)
                //{
                //    result = reportProcessor.RenderReport("HTML", rep, null);
                //    theMemStream = new MemoryStream(result.DocumentBytes);
                //    theMemStream.WriteTo(fs);
                //    theMemStream.Close();
                //}
  
                result = reportProcessor.RenderReport("HTML", reportBook, null);
                //result = reportProcessor.RenderReport("HTML", rep, null);
                theMemStream = new MemoryStream(result.DocumentBytes);
                theMemStream.WriteTo(fs);
                theMemStream.Close();
  
                fs.Close();
  
  
  
  
                MailMessage mail = new MailMessage();
                mail.From = new MailAddress("sysbsareporter@barcap.com");
  
                foreach (string SendTo in Properties.Settings.Default.SendTo.Split(';'))
                {
                    mail.To.Add(SendTo);
                }
                mail.Subject = "BSA Monday Reports " + date;
  
                //AlternateView aView = new AlternateView(string.Format("{0}\\BSA_ChangeReport{1}.txt", ReportPath, date));
                StreamReader sr = new StreamReader(string.Format("{0}\\BSA_MondayReports_{1}.MHTML", ReportPath, date));
                mail.IsBodyHtml = true;
                mail.Body = sr.ReadToEnd();
                //mail.Body = "See Attached";
  
                sr.Close();
  
                Attachment item = new Attachment(string.Format("{0}\\BSA_MondayReports_{1}.PDF", ReportPath, date));
                mail.Attachments.Add(item);
                SmtpClient smtp = new SmtpClient("smtphost.mydomain");
                smtp.Send(mail);
  
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
                Console.WriteLine(ex.InnerException.ToString());
                Console.Read();
            }
        }
    }
}

 

 

 

 

0
Steve
Telerik team
answered on 25 Aug 2010, 07:39 AM
Hi guys,

@BobT732: Take a look at the following forum post about the export to HTML.
@Andrea: the bugfix Michael is talking about is already present in our latest internal build. Please login to your account to download it and upgrade. You can see the release notes here.

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
Andrea Rapuzzi
Top achievements
Rank 1
answered on 07 Oct 2010, 03:09 PM
Hi Steve,

thanks for your reply, I've already downoladed the new Report version and all works fine.

Thanks again !

Andrea

Tags
General Discussions
Asked by
Michael Hilgers
Top achievements
Rank 1
Answers by
Steve
Telerik team
Andrea Rapuzzi
Top achievements
Rank 1
Michael Hilgers
Top achievements
Rank 1
Robert
Top achievements
Rank 1
Share this question
or