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.

Related articles

2 comments

Read the comments left by other users below, or:

Get your own gravatar by visiting gravatar.com ayix
#1. August 25th, 2010, at 11:21 AM.

I already try that code, but when I type:
excel.ExportPageHeadersAndFooters = (ExportPageAreaKind.OnEachPage);
There’s an error in code. The code didn’t recognize method ExportPageHeadersAndFooters whereas I already type:
using CrystalDecisions.CrystalReports.Engine;
using CrystalDecisions.Shared;
Would you help me please… I have a problem about footer when exporting crystal report to excel.

Get your own gravatar by visiting gravatar.com admin
#2. September 7th, 2010, at 7:23 PM.

Hie Ayix,

Which version of VS are you using? If my memory serves me right, I tried the code on VS2008 and it worked.

Leave your comment...

If you want to leave your comment on this article, simply fill out the next form:




You can use these XHTML tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> .