March 31st, 2010

You are currently browsing the articles from Information City written on March 31st, 2010.

Crystal Report export to Excel: missing footer

There’s this mystery issue happened in the recent Visual Studio project code upgrade. The problem happens after upgrading from Visual Studio 2003 to Visual Studio 2008. Those reports which were exported to Excel document found out to have missing footer but the same issue did not happen to other reports type (pdf/word).

Searching around the net, found this link. Posted on SAP community network Forum, the very same problem which I am facing. User “A G” posted some codes which worth trying:

Something that I tried in VS2005 and CRXIR2SP2 (higher that 10) to bring the footer contents in every page:

ReportDocument RDObject = new ReportDocument();
// Loading the report
RDObject.Load(Server.MapPath(“Employee Sales.rpt”));
// Passing the parameter to report
RDObject.SetParameterValue(“Employee ID”,”AFTRD”);

ExportOptions exop = new ExportOptions();

// Setting the format to Excel type
ExcelFormatOptions excel = ExportOptions.CreateExcelFormatOptions();
exop.ExportFormatType=ExportFormatType.Excel;
exop.ExportFormatOptions=excel;

// Enabling the headers and footers for each page
excel.ExportPageHeadersAndFooters = (ExportPageAreaKind.OnEachPage);
CrystalReportViewer1.ReportSource = RDObject ;

// Exporting the report
RDObject.ExportToHttpResponse(exop, Response, true, “”);

I haven’t try it myself but the user has claimed it manage to print the footer on each of the pages. Probably will try it out later.

Keywords:

Written by admin on March 31st, 2010 with 2 comments.
Read more articles on Entertainment.