Converting Crystal report to PDF

2019-02-21 05:43发布

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?

5条回答
做个烂人
2楼-- · 2019-02-21 06:16

To convert crystal report to PDF, you may try PDF libraries that will print crystal report to pdf file.

查看更多
成全新的幸福
3楼-- · 2019-02-21 06:27

Please try this : first create instance of Crystal report, and you can simply Call Export To disk

  RtpDocument.ExportToDisk(ExportFormatType.PortableDocFormat, "C:\report.pdf")
查看更多
小情绪 Triste *
4楼-- · 2019-02-21 06:31
foreach (ReportObject objReport in rpt.ReportDefinition.Sections["Section3"].ReportObjects)
{
   FieldObject objField = (FieldObject)objReport;
   objField.ApplyFont(new Font("Arial", 8.25F, FontStyle.Italic, GraphicsUnit.Point, ((byte)(0))));
}

For PDF, See following:

查看更多
混吃等死
5楼-- · 2019-02-21 06:34
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;
}
查看更多
我命由我不由天
6楼-- · 2019-02-21 06:40
ReportDocument reportobj = //Add code to return valid report document from a crystal report 
if (reportobj != null)
{
    //Export to PDF
    ((ReportDocument)reportobj).ExportToDisk(ExportFormatType.PortableDocFormat, file);
    //Open using default app for PDF docs
    if (System.IO.File.Exists(file))
         System.Diagnostics.Process.Start(file);
}
查看更多
登录 后发表回答