Home » c# » c# – CrystalDecisions.Shared.CrystalReportsException:Load report failed. The document has not opened-Exceptionshub

c# – CrystalDecisions.Shared.CrystalReportsException:Load report failed. The document has not opened-Exceptionshub

Posted by: admin February 24, 2020 Leave a comment


I have method and I am using crystal-decision report and its throwing an inner exception. How do I fix this issue? I have seen similar topic, but mine does not really solve similar problem as I have attempted to do the same. Please see my logic below and screen shot for more detail. In another words my load method does not open.

// Controller
public ActionResult AdvertReport(FormCollection fc)
    DataSet ds = obIlReports.Generate_AdvertDetailsReport();
    ds.Tables[0].TableName = "Tbl_TrainingAcademy";

    if(ds.Tables[0].Rows.Count > 0)
        ReportClass rptH = new ReportClass();
        rptH.FileName = Server.MapPath("~/Reports/AdvertReport.rpt");
        rptH.Load(); // The document do not open error is thrown here.
        Response.Buffer = false;

        Stream stream = rptH.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat);
        stream.Seek(0, SeekOrigin.Begin);
        return File(stream, "application/pdf", "AdvertReport.pdf");
    return View();
// Ilreport here with store procedure.
public class ReportsMaster : IlReports
    public DataSet Generate_AdvertDetailsReport()
        using(SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["eNtsaOnlineRegistrationDB"].ToString()))
            DataSet ds = new DataSet();

            // Handling Exception
                SqlCommand cmd = new SqlCommand("dbo.GetAdvertReport", con);
                cmd.CommandType = CommandType.StoredProcedure;
                SqlDataAdapter da = new SqlDataAdapter();
                da.SelectCommand = cmd;

                if(ds.Tables.Count > 0)
                    return ds;
                    return ds = null;

            catch(Exception )
// ConnectionString
    <add name="eNtsaOnlineRegistrationDB" connectionString="Data Source=GcobaniM-L\SQLEXPRESS; DataBase=eNtsaOnlineRegistrationDB; Integrated Security=True" providerName="System.Data.SqlClient" />
How to&Answers:
  1. The problem i had was simple, i created report file without having an extension report like crystal report install for Microsoft Visual Studio. Here is the link for Windows for your compatibility.


  1. After the installation of this software, the Visual Studio will have Reporting. See my screen shot for idea or clue.
    enter image description here

  2. Make sure your VS is closed until the software is done.

  3. Then you create your report and give a its path based on your project application.

  4. If you get an exception like one below;

Could not load file or assembly CrystalDecisions.CrystalReports.Engine

  1. Follow the steps as mentioned from the forum and your application should work, if not troubleshoot.