高分求助水晶报表高手!web中导出功能怎么是这样,把整个web页面都导出了?????

alialiquan 2004-10-05 05:32:26
打印功能也是,它用AdaodReader打印,但是格是不能识别。这是怎么回事啊?我是刚升级的crystalreport9.2.2.3300,系统是2003。快帮忙啊!!!!
...全文
64 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
shanminmin 2004-10-06
  • 打赏
  • 举报
回复
不导出整个web页,你想导出什么?
happyjun2000 2004-10-06
  • 打赏
  • 举报
回复
public void ExportCrystalReport(string targetFileName,string reportPath,string docFormat,string passWrd)
{
ReportDocument oRD = new ReportDocument();
ExportOptions oExO ;
DiskFileDestinationOptions oExDo=new DiskFileDestinationOptions();
oRD.Load(reportPath);
//oRD.SetDataSource(myDS);
oRD.Refresh();
this.SetConnectionInfo(oRD,passWrd);

oExDo.DiskFileName = targetFileName ;
oExO = oRD.ExportOptions;
oExO.ExportDestinationType = ExportDestinationType.DiskFile;
switch (docFormat)
{
case "pdf":
oExO.ExportFormatType = ExportFormatType.PortableDocFormat;
break;
case "doc":
oExO.ExportFormatType = ExportFormatType.WordForWindows;
break;
case "xls":
oExO.ExportFormatType = ExportFormatType.Excel;
break;
case "htm":
oExO.ExportFormatType = ExportFormatType.HTML40;
break;
case "html":
oExO.ExportFormatType = ExportFormatType.HTML40;
break;
default:oExO.ExportFormatType = ExportFormatType.Excel;break;
}
oExO.DestinationOptions = oExDo;

oRD.Export();
oRD.Close();
}


public void ExportCrystalReport(ReportDocument oRD,string docFormat,string targetFileName)
{
//ReportDocument oRD = new ReportDocument();
ExportOptions oExO ;
DiskFileDestinationOptions oExDo=new DiskFileDestinationOptions();
// oRD.Load(reportPath);
// oRD.SetDataSource(myDS);
//oRD.Refresh();
//this.SetConnectionInfo(oRD,passWrd);




oExDo.DiskFileName = targetFileName ;
oExO = oRD.ExportOptions;
oExO.ExportDestinationType = ExportDestinationType.DiskFile;
switch (docFormat)
{
case "pdf":
oExO.ExportFormatType = ExportFormatType.PortableDocFormat;
break;
case "doc":
oExO.ExportFormatType = ExportFormatType.WordForWindows;
break;
case "xls":
oExO.ExportFormatType = ExportFormatType.Excel;
break;
case "htm":
oExO.ExportFormatType = ExportFormatType.HTML40;
break;
case "html":
oExO.ExportFormatType = ExportFormatType.HTML40;
break;
default:oExO.ExportFormatType = ExportFormatType.Excel;break;
}
oExO.DestinationOptions = oExDo;

oRD.Export();
oRD.Close();
}
alialiquan 2004-10-05
  • 打赏
  • 举报
回复
偌大个csdn,就没有精通水晶报表的吗?
alialiquan 2004-10-05
  • 打赏
  • 举报
回复
我是说报表中自带的导出功能阿。这些代码往哪填啊?
fenglinzh 2004-10-05
  • 打赏
  • 举报
回复
public void ExportReportToPdf(CrystalDecisions.CrystalReports.Engine.ReportClass opt)
{
try
{
DiskFileDestinationOptions DiskOpts = new DiskFileDestinationOptions();

opt.ExportOptions.ExportDestinationType = CrystalDecisions.Shared.ExportDestinationType.DiskFile;

opt.ExportOptions.ExportFormatType = CrystalDecisions.Shared.ExportFormatType.PortableDocFormat;

DiskOpts.DiskFileName = System.Web.HttpContext.Current.Server.MapPath(System.Web.HttpContext.Current.Session.SessionID.ToString()+".pdf"); //

opt.ExportOptions.DestinationOptions = DiskOpts;

opt.Export();

System.Web.HttpContext.Current.Response.ClearContent();
System.Web.HttpContext.Current.Response.ClearHeaders();
System.Web.HttpContext.Current.Response.ContentType = "application/pdf";
System.Web.HttpContext.Current.Response.WriteFile(DiskOpts.DiskFileName);
System.Web.HttpContext.Current.Response.Flush();
System.Web.HttpContext.Current.Response.Close();
System.IO.File.Delete(DiskOpts.DiskFileName);
}
catch( Exception err )
{
System.Web.HttpContext.Current.Response.Write(err.ToString());
}
}

110,561

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧