on 10-01-2008 12:54 PM
I'm using a CrystalReportViewer (from vs2008) to show a report in a wpf application.
Because I want to get the total page count from the report, on loading the report I do a crystalReportViewer.ShowLastPage(), than a .GetCurrentPageNumber() and than a .ShowFirstPage().
With this method i'm not only getting the total number of pages, but also the report is loaded in 'cache' so browsing the report is faster.
But, as long as the .ShowLastPage() method is busy, my wpf application (or any other application i'm using the viewer in), is locked.
Is there a way to load the whole report on another thread? So my program will continue running while the report is loading...
Hi
you can export your report and show it in a browser Using the ExportToHttpResponse() Method
For e.g. -
ExportToHttpResponse(CrystalDecisions.Shared.ExportFormatType formatType, System.Web.HttpResponse response, bool asAttachment, string attachmentName)
ExportToHttpResponse(CrystalDecisions.Shared.ExportOptions options, System.Web.HttpResponse response, bool asAttachment, string attachmentName)
For exporting you can download sample code from [here|https://boc.sdn.sap.com/codesamples].
You can also take help from [Dev library|https://boc.sdn.sap.com/node/7770]
Hope this helps!!
Regards,
Amit
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Dennis,
Sorry I don't have an answer for you but I'm stuck with a similar problem. I'm trying to load several reports each displaying in it's own report viewer component in a tabcontrol. Just want to know if you found any more info regarding the issue?
At the moment, my application waits for each report to finish loading before the apllication becomes responsive again. (VS2008 + CR2008 SP1)
Thanx
Philip
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
This is a snippet of code where the report is exported via a thread. Now, since CR is based on Single Thread Apartment model, the report must remain within the thread. See if this snippet will help:
using System;
using CrystalDecisions.CrystalReports.Engine;
using CrystalDecisions.Shared;
namespace thread
{
/// <summary>
/// Summary description for clsThread.
/// </summary>
//
public class clsThread
{
ReportDocument crRPT = new ReportDocument ();
string strExportFileName;
public clsThread(string strRPTName, string strExportName)
{
//
// TODO: Add constructor logic here
//
// Load report return true if successfull false otherwise
try
{
strExportFileName = strExportName;
crRPT.Load (strRPTName);
}
catch
{
throw;
}
}
public void ExportToRPT()
{
//
// TODO: Add constructor logic here
//
try
{
crRPT.ExportToDisk (ExportFormatType.CrystalReport,strExportFileName);
crRPT = null;
}
catch
{
throw;
}
}
public void ExportToRTF()
{
//
// TODO: Add constructor logic here
//
try
{
crRPT.ExportToDisk (ExportFormatType.RichText,strExportFileName);
crRPT = null;
}
catch
{
throw;
}
}
public void ExportToPDF()
{
//
// TODO: Add constructor logic here
//
try
{
crRPT.ExportToDisk (ExportFormatType.PortableDocFormat,strExportFileName);
crRPT = null;
}
catch
{
throw;
}
}
}
}
Ludek
User | Count |
---|---|
81 | |
10 | |
10 | |
9 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.