Print Page | Close Window

Can't export my report as PDF

Printed From: Crystal Reports Book
Category: Crystal Reports 9 through 2020
Forum Name: Technical Questions
Forum Discription: Formulas, charting data, Crystal syntax, etc.
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=5835
Printed Date: 29 Apr 2024 at 11:06pm


Topic: Can't export my report as PDF
Posted By: WolfgangS
Subject: Can't export my report as PDF
Date Posted: 20 Mar 2009 at 5:13am
Hi,
 I can show my report successfully and want to export it to a pdf file.

  • After rightclick on the report->export->(Format:Adobe PDF, Destination: Disk File) -> OK -> OK happends nothing.

  • Same when I click on the export button (.EnableExportButton = True)


This happends with the CR object for 8.5 and 10.
I even tried a report file without any parameters (differs form the source below)


any help would be very appreciated ... Cry


MfG
 WolfgangS



this is my code:

Private Sub Form_Load()
 
  Dim objActReport As CRAXDRT.Report
  Dim objApplication As CRAXDRT.Application
  Dim objRst As ADODB.Recordset

  Set objApplication = New CRAXDRT.Application
  Set objActReport = New CRAXDRT.Report
  Set objRst = New ADODB.Recordset

  Set objActReport = objApplication.OpenReport("C:\Program Files\CodeCheckerWorld\RPT_HANS.rpt")

  Call objActReport.DiscardSavedData

  With objActReport
    .ReportTitle = "CodeChecker 4 - accepted  hints"
    .ParameterFields.GetItemByName("Username").AddCurrentValue "zzz"
    .ParameterFields.GetItemByName("SWVersion").AddCurrentValue "yyyy
    .ParameterFields.GetItemByName("ReportSubTitle").AddCurrentValue "xxxx"
    Call .Database.SetDataSource(objRst, 3, 1)
  End With

  With CrystalActiveXReportViewer1
    .EnableExportButton = True
    .ReportSource = objActReport           ' pass the hints
    .ViewReport                            ' call it
  End With
 
End Sub




Replies:
Posted By: shortduck
Date Posted: 20 Mar 2009 at 6:13am
Hi this is what i am using
 
I have two version and both of them are working;
 
a] with RAS
 

CrystalDecisions.ReportAppServer.CommonObjectModel.ByteArray myBytes;

// Now export as PDF

myBytes = rptClientDoc.PrintOutputController.Export(CrystalDecisions.ReportAppServer.ReportDefModel.CrReportExportFormatEnum.crReportExportFormatPDF, 0);

HttpContext.Current.Response.Clear();

HttpContext.Current.Response.AddHeader("content-disposition", "inline,filename=untitled.pdf");

HttpContext.Current.Response.ContentType = "application/pdf";

HttpContext.Current.Response.BinaryWrite(myBytes.ByteArray);

the std way:

HttpContext.Current.Response.Buffer = false;

HttpContext.Current.Response.Clear();

HttpContext.Current.Response.ClearContent();

HttpContext.Current.Response.ClearHeaders();

rpt.ExportToHttpResponse(ExportFormatType.PortableDocFormat, HttpContext.Current.Response, false, "Report");

 rpt.Close();

 rpt.Dispose();



Posted By: WolfgangS
Date Posted: 20 Mar 2009 at 6:24am
Hi,
 thank you for your answer.

I had to change buggy Crystal Reports dlls with newer ones.
Unfortunately I couldn't couldn't figure out how because it wasn't able to
register the newer ones, so I installed CR8.5, installed SP3 and tadaaa ...
it worked fine.

The key to find the solution was ErrorCode 80047784 which appears
when I force an export by code.

thank you anyway :)

Wolfgangs





Print Page | Close Window