转换Crystal报表为PDF [英] Converting Crystal report to PDF

查看:208
本文介绍了转换Crystal报表为PDF的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有在水晶报表(C#.NET)提供的任何设施的字体切换到其他的语言吗?如果没有,如何水晶报表转换为PDF格式?

解决方案

 保护无效的Page_Load(对象发件人,EventArgs的)
{
    ExportOptions objExOpt;

    CrystalReportViewer1.ReportSource =(对象)getReportDocument();
    CrystalReportViewer1.DataBind();
    //获取报表文档
       的ReportDocument repDoc = getReportDocument();

    repDoc.ExportOptions.ExportFormatType = ExportFormatType.PortableDocFormat;
    repDoc.ExportOptions.ExportDestinationType = ExportDestinationType.DiskFile;
    DiskFileDestinationOptions objDiskOpt =新DiskFileDestinationOptions();
    objDiskOpt.DiskFileName = @C:\水晶报表\ TFA.pdf;
    repDoc.ExportOptions.DestinationOptions = objDiskOpt;
    repDoc.Export();
 }

私人的ReportDocument getReportDocument()
{
  //文件路径水晶报表
  串repFilePath =使用Server.Mappath(〜/ CrystalReport1.rpt);
  //声明一个新的Crystal Reports文档对象
  //和报表文件到报表文档
  的ReportDocument repDoc =新的ReportDocument();

  repDoc.Load(repFilePath);

  //通过获得来自企业的数据集设置数据源
  //层和
 //在本例中的业务层是getCustomerData功能
 返回repDoc;
}
 

is there any facility available in crystal report(c# .net) to change the font to some other language? if no, how to convert crystal report to pdf format?

解决方案

protected void Page_Load(object sender, EventArgs e)
{
    ExportOptions objExOpt;

    CrystalReportViewer1.ReportSource = (object)getReportDocument();
    CrystalReportViewer1.DataBind();
    // Get the report document
       ReportDocument repDoc = getReportDocument();

    repDoc.ExportOptions.ExportFormatType = ExportFormatType.PortableDocFormat;
    repDoc.ExportOptions.ExportDestinationType = ExportDestinationType.DiskFile;
    DiskFileDestinationOptions objDiskOpt = new DiskFileDestinationOptions();
    objDiskOpt.DiskFileName = @"c:\crystal report\TFA.pdf";
    repDoc.ExportOptions.DestinationOptions = objDiskOpt;
    repDoc.Export();
 }

private ReportDocument getReportDocument()
{
  // File Path for Crystal Report
  string repFilePath = Server.MapPath("~/CrystalReport1.rpt");
  // Declare a new Crystal Report Document object
  // and the report file into the report document
  ReportDocument repDoc = new ReportDocument();

  repDoc.Load(repFilePath);

  // Set the datasource by getting the dataset from business
  // layer and
 // In our case business layer is getCustomerData function
 return repDoc;
}

这篇关于转换Crystal报表为PDF的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆