Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > .NET > Other .NET > Crystal Reports
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old October 21st, 2003, 04:12 AM
Registered User
 
Join Date: Oct 2003
Location: , , Italy.
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Pdf Crystal Report export

Hi,

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.
Thanks.

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.CrystalDoc.Load(MyReport.HardCopyUrl);
   this.CRViewer.ReportSource = this.CrystalDoc;
   ((TableLogOnInfo)this.CRViewer.LogOnInfo[0]).ConnectionInfo.Password = "pwd";
   this.CRViewer.DataBind();
  }
  #region Web Form Designer generated code
  override protected void OnInit(EventArgs e)
  {
   //
   // CODEGEN: This call is required by the ASP.NET Web Form Designer.
   //
   InitializeComponent();
   base.OnInit(e);
  }

  /// <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);
  }
  #endregion
  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();
   this.CrystalDoc.SetDatabaseLogon("USR","pwd");

   this.CrystalDoc.FormatEngine.Export();
  }
  private void Init_Report(object sender, System.EventArgs e)
  {
  }
  private void CrystalDoc_InitReport(object sender, System.EventArgs e)
  {
  }
 }
}


Reply With Quote
  #2 (permalink)  
Old October 21st, 2003, 09:38 AM
Authorized User
 
Join Date: Oct 2003
Location: , , .
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to TEDY Send a message via MSN to TEDY
Default

did you tried

crystalReportViewer1.ExportReport(); ?

Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

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 05: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



All times are GMT -4. The time now is 05:08 AM.


Powered by vBulletin®
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.