Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > Other .NET > Crystal Reports
Crystal Reports General discussion about Crystal Reports. For discussions specific to the book Professional Crystal Reports for VS.NET, please see the book discussion forum for that book.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Crystal Reports section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old October 21st, 2003, 04:12 AM
Registered User
Join Date: Oct 2003
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Pdf Crystal Report export


I'm searching for help about exporting to pdf format a report in a Web Form. I followed typical indication found in the internet and in the book written by David McAmis, without a significative result.
I have a page with the CR ReportViewer, the CR ReportDocument, and a button vcomponents, last of which lauches the code for exporting to a pdf file. The pdf is generated, but is empty.
I got the following errors:

1- "Error while processing of the page. Insufficient numbers of operands".
2- "Unkknow token found: 0,05"

The file occupies 56 kb. Folder Permissions are ok. Credentials for the database are re-inserted.
Any help is welcome.
Here's the Web Form' code behind.

using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using CrystalDecisions.Shared;
using CrystalDecisions.CrystalReports.Engine;

namespace Accenture.IS_Italy.UI.Web.Report
 /// <summary>
 /// Summary description for ReportCRPage.
 /// </summary>
 public class ReportCRPage : System.Web.UI.Page
  protected CrystalDecisions.Web.CrystalReportViewer CRViewer;
  protected System.Web.UI.WebControls.Button btnPdf;
  protected CrystalDecisions.CrystalReports.Engine.ReportDocum ent CrystalDoc;

  private void Page_Load(object sender, System.EventArgs e)
   MyReport = <extract report business object from Session>;
   this.CRViewer.ReportSource = this.CrystalDoc;
   ((TableLogOnInfo)this.CRViewer.LogOnInfo[0]).ConnectionInfo.Password = "pwd";
  #region Web Form Designer generated code
  override protected void OnInit(EventArgs e)
   // CODEGEN: This call is required by the ASP.NET Web Form Designer.

  /// <summary>
  /// Required method for Designer support - do not modify
  /// the contents of this method with the code editor.
  /// </summary>
  private void InitializeComponent()
   this.CrystalDoc = new CrystalDecisions.CrystalReports.Engine.ReportDocum ent();
   this.CRViewer.Init += new System.EventHandler(this.Init_Report);
   this.btnPdf.Click += new System.EventHandler(this.btnPdf_Click);
   // CrystalDoc
   this.CrystalDoc.PrintOptions.PaperOrientation = CrystalDecisions.Shared.PaperOrientation.DefaultPa perOrientation;
   this.CrystalDoc.PrintOptions.PaperSize = CrystalDecisions.Shared.PaperSize.DefaultPaperSize ;
   this.CrystalDoc.PrintOptions.PaperSource = CrystalDecisions.Shared.PaperSource.Upper;
   this.CrystalDoc.PrintOptions.PrinterDuplex = CrystalDecisions.Shared.PrinterDuplex.Default;
   this.CrystalDoc.InitReport += new System.EventHandler(this.CrystalDoc_InitReport);
   this.Load += new System.EventHandler(this.Page_Load);
  private void btnPdf_Click(object sender, System.EventArgs e)
   DiskFileDestinationOptions dfdoReportFile = new DiskFileDestinationOptions();
   ExportOptions crepExportOptions = CrystalDoc.FormatEngine.ExportOptions;

   dfdoReportFile.DiskFileName = "C:\\Inetpub\\wwwroot\\<AppName>\\script\\Report\\ Pdf\\RepCR.pdf";

   crepExportOptions.DestinationOptions = dfdoReportFile;
   crepExportOptions.ExportDestinationType = ExportDestinationType.DiskFile;
   crepExportOptions.ExportFormatType = ExportFormatType.PortableDocFormat;
   TableLogOnInfo credentials = new TableLogOnInfo();

  private void Init_Report(object sender, System.EventArgs e)
  private void CrystalDoc_InitReport(object sender, System.EventArgs e)

Old October 21st, 2003, 09:38 AM
Authorized User
Join Date: Oct 2003
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to TEDY Send a message via MSN to TEDY

did you tried

crystalReportViewer1.ExportReport(); ?

Similar Threads
Thread Thread Starter Forum Replies Last Post
Export Crystal Report to PDF aarunlal ASP.NET 2.0 Professional 1 June 28th, 2006 01:18 PM
Export to PDF problem with crystal report in c# fidelio ASP.NET 1.0 and 1.1 Professional 0 April 12th, 2006 07:34 AM
facing problem to export crystal report to PDF whi agarwal Beginning VB 6 0 November 12th, 2005 06:57 AM
Crystal Report 8.5 Export to PDF problem DragonSon Crystal Reports 0 August 17th, 2004 10:32 PM
Crystal Report Export to PDF with embedded Barcode matt.fields Crystal Reports 1 June 12th, 2004 05:26 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.