Bind Crystal report data to Excel sheet
using System.IO;// namespace for Memorystream
your_Call_event
{
string repName = "MY REPORT";
MemoryStream oStream;
oStream = (MemoryStream)
CRYSTAL_REP_NAME.ExportToStream(CrystalDecisions.Shared.ExportFormatType.Excel);
Response.Clear();
Response.Buffer = true;
CRYSTAL_REP_NAME.ExportToHttpResponse(ExportFormatType.Excel, Response, false, repName);
Response.BinaryWrite(oStream.ToArray());
HttpContext.Current.ApplicationInstance.CompleteRequest();
}
your_Call_event
{
string repName = "MY REPORT";
MemoryStream oStream;
oStream = (MemoryStream)
CRYSTAL_REP_NAME.ExportToStream(CrystalDecisions.Shared.ExportFormatType.Excel);
Response.Clear();
Response.Buffer = true;
CRYSTAL_REP_NAME.ExportToHttpResponse(ExportFormatType.Excel, Response, false, repName);
Response.BinaryWrite(oStream.ToArray());
HttpContext.Current.ApplicationInstance.CompleteRequest();
}
Comments
Post a Comment