Skip to Content

Crystal Reports problem in VS19

Hello,

I'm working in Visual Studio 2019 and the app is working fine except when I try to export a report, I get an error:

Method not found: 'Void CrystalDecisions.ReportAppServer.ReportDefModel.PDFExportFormatOptionsClass.set_CurrentPageNumber(Int32)'.

I have tried many different solutions but nothing seems to work.

Help would be very much appreciated.

Thank you in advance!

Damad

Add a comment
10|10000 characters needed characters exceeded

Related questions

8 Answers

  • Best Answer
    Posted on Jun 18, 2019 at 10:50 AM

    Ok, so I've fixed the issue.

    If anyone runs into this issue, please make sure that your datasource in the report is correct. In our case it was still connected to the old database and that was the problem. Once changed, it worked fine.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on May 29, 2019 at 12:43 PM

    What CR for VS SP are you using?

    Does it work exporting from the Viewer?

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on May 30, 2019 at 08:10 PM

    It works in the Viewer and I can check it in the solution, but once I run it locally or on a server it won't export it, providing me with he aforementioned error.

    I use VS 2019 and it's the latest CR SP25

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on May 31, 2019 at 01:30 PM

    Did you install the SP 25 MSI package on the Server.

    Use Process Monitor to see where the error is being generated.

    Add a comment
    10|10000 characters needed characters exceeded

    • We have SP 25 MSI package on the Server, as far as Process Monitor goes, it's not giving us anything comprehensible.

      name.ExportToHttpResponse(ExportFormatType.PortableDocFormat, Response, false, "ExportedReport");

      That's the line of code that's throwing an exception or error, where "name" is ReportDocument.

      Error keeps occurring regardless of what we try.

      We have tried reinstalling everything. We tried using different frameworks, but the rest of the project is only working in 4.5 and 4.7.2.

      We even tried running the whole solution in VS17, but it didn't help.

      We are using log4net but not the latest version because when we use the newest version, it's not allowing us the usage in webconfig file.

      Same error occurs in the method ExportToDisk

      Any suggestion would be much appreciated.

      Thanks in advance.

  • Posted on Jun 07, 2019 at 08:51 PM

    Look for access denied errors in the PM log.

    Does it work for any other format?

    Look in the install log and see if anything failed:

    C:\Program Files (x86)\SAP BusinessObjects\Crystal Reports for .NET Framework 4.0\Common\SAP BusinessObjects Enterprise XI 4.0\logging

    Do you have Adobe Reader installed on the Server? It is required.

    Don

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jun 10, 2019 at 02:43 PM

    See if this works:

    #region PDF
    {
        // This works do not alter
        // this gets the report name and sets the export name to be the same less the extension
        string outputFileName = "";
        string MyRptName = rpt.FileName.ToString();
        outputFileName = MyRptName.Substring(9, rpt.FileName.Length - 9);
        outputFileName = outputFileName.Substring(0, (outputFileName.Length - 3)) + "pdf";
    
        try
        {
            if (File.Exists(outputFileName))
            {
                File.Delete(outputFileName);
            }
    
            CrystalDecisions.ReportAppServer.ReportDefModel.PDFExportFormatOptions RasPDFExpOpts = new PDFExportFormatOptions();
    
            try
            {
                RasPDFExpOpts = rptClientDoc.get_SavedExportOptions(CrReportExportFormatEnum.crReportExportFormatPDF);
            }
            catch (Exception ex)
            {
                btnSQLStatement.Text = "ERROR: " + ex.Message;
                //return;
            }
    
            // Set them now:
            //RasPDFExpOpts.CreateBookmarksFromGroupTree = false;
            //RasPDFExpOpts.EndPageNumber = 1;
            //RasPDFExpOpts.StartPageNumber = 1;
    
            // Save the udpated info
            if (RasPDFExpOpts != null )
                rptClientDoc.set_SavedExportOptions(CrReportExportFormatEnum.crReportExportFormatPDF, RasPDFExpOpts);
    
            CrystalDecisions.ReportAppServer.ReportDefModel.ExportOptions exportOpts1 = new CrystalDecisions.ReportAppServer.ReportDefModel.ExportOptions();
            exportOpts1.ExportFormatType = CrReportExportFormatEnum.crReportExportFormatPDF;
            exportOpts1.FormatOptions = RasPDFExpOpts;
    
            // And Export
            rptClientDoc.PrintOutputController.ExportEx(exportOpts1).Save(outputFileName, true);
            MessageBox.Show("Export to PDF Completed", "", MessageBoxButtons.OK, MessageBoxIcon.Information);
        }
        catch (Exception ex)
        {
            btnSQLStatement.Text = "ERROR: " + ex.Message;
            return;
        }
        // This works do not alter
        }
    #endregion PDF
    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jun 11, 2019 at 03:49 PM

    mmm, just confirmed it works for me.

    Try a report without parameters and see if that works.

    You can't get any more simpler than this:

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using CrystalDecisions.CrystalReports.Engine;
    using CrystalDecisions.Shared;
    
    public partial class _Default : System.Web.UI.Page
    {
        protected void Page_Init(object sender, EventArgs e)
        {
            CrystalDecisions.CrystalReports.Engine.ReportDocument rpt = new ReportDocument();
            rpt.Load(@"c:\reports\World Sales Report.rpt");
            CrystalReportViewer1.ReportSource = rpt;
            rpt.ExportToHttpResponse(ExportFormatType.PortableDocFormat, Response, false, "ExportedReport");
    
        }
    }
    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jun 12, 2019 at 02:54 PM

    Yes, You need the same DB client installed on the App server where CR runtime is as the report was created with.

    CR is simply passing the DB error code to you from the DB.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.