GithubHelp home page GithubHelp logo

gerardo-lijs / crystalreportsrunner Goto Github PK

View Code? Open in Web Editor NEW
50.0 6.0 14.0 5.07 MB

Runner to allow the use of Crystal Reports in .NET Core using external process (in .NET Framework 4.8) and named pipes for communication

License: MIT License

C# 100.00%
crystal-reports net48 netcore

crystalreportsrunner's Introduction

Crystal Reports Runner

Runner to allow the use of Crystal Reports in .NET Core using external process (in .NET Framework 4.8) and named pipes for communication.

If you are using Crystal Reports in your application you're probably stuck with .NET Framework 4.x. However, all the new features are in the .NET Core framework nowadays and you might want to take advantage of them by upgrading your app to use the latest version of .NET.

Unfortunately, Crystal Reports doesn't support .NET Core so one workaround is to isolate it into its own executable so that your own application doesn't need to have a dependency on Crystal Reports SDK.

Quick Start

  1. Create a new Console Application and reference one of these NuGet packages depending the Crystal Reports runtime version you're using:

    • Crystal Reports v13.0.35 x64: NuGet version

    • Crystal Reports v13.0.35 x86: NuGet version

    • Crystal Reports v13.0.34 x64: NuGet version

    • Crystal Reports v13.0.34 x86: NuGet version

    • Crystal Reports v13.0.33 x64: NuGet version

    • Crystal Reports v13.0.33 x86: NuGet version

    • Crystal Reports v13.0.32 x64: NuGet version

    • Crystal Reports v13.0.32 x86: NuGet version

    • Crystal Reports v13.0.20 x64: NuGet version

    • Crystal Reports v13.0.20 x86: NuGet version

    • You need a version that is not listed here? Please refer to Creating a custom Runner or contact us.

    • You can download SAP Crystal Reports runtime engine for .NET Framwork from SAP download website

  2. Create an engine:

    using LijsDev.CrystalReportsRunner.Core;
    
    using var engine = new CrystalReportsEngine();
  3. Optionally customizing viewer settings:

    engine.ViewerSettings.AllowedExportFormats =
        ReportViewerExportFormats.PdfFormat |
        ReportViewerExportFormats.ExcelFormat;
    
    engine.ViewerSettings.ShowRefreshButton = false;
    engine.ViewerSettings.ShowCopyButton = false;
    engine.ViewerSettings.ShowGroupTreeButton = false;
    
    engine.ViewerSettings.SetUICulture(Thread.CurrentThread.CurrentUICulture);
  4. Show the report and provide a connection string:

    var report = new Report("SampleReport.rpt", "Sample Report")
    {
        Connection = CrystalReportsConnectionFactory.CreateSqlConnection(
            ".\\SQLEXPRESS", 
            "CrystalReportsSample")
    };
    
    report.Parameters.Add("ReportFrom", new DateTime(2022, 01, 01));
    report.Parameters.Add("UserName", "Gerardo");
    
    await engine.ShowReportDialog(report);

Samples

Samples are available in this repo.

Guides

Thanks

  • This library heavily depends on PipeMethodCalls for Named Pipe communication.
  • The signing certificate for the runners is provided by Microptic S.L.

MIT License

Copyright (c) 2022-2023 Gerardo Lijs

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

crystalreportsrunner's People

Contributors

gerardo-lijs avatar jaceks2106 avatar mhmd-azeez avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

crystalreportsrunner's Issues

Intergrated Security False

Thank you very much for sharing this project.
I am somehow failing to get it to work for me. I need to have it work where integrated security is false but the report is failing to pick up the database, username and passwork. I am just not sure what i am doing wrong. Its most probably something im missing since even the sample is giving me the same problem.
Sample Report Error

I have a PipeInvokeFailedException

Hi,

On a project, I have this exception :
PipeMethodCalls.PipeInvokeFailedException : 'System.IndexOutOfRangeException: Could not find column 2.

The report has been created with CR SP34.

I join a little project to reproduce.

TestReport.zip

print to printer

Dear Gerardo, thanks a lot for you solution
but I COULDN'T FIND print to printer
it's very important to print receipts directly without opening the preview
thanks a lot
I cannot wait for your response

Passing byte arrays in dataset to report

the report is using dataset made with net framework
in my net core app i pass in memory dataset with the same table name and columns
everything works but not the byte array

Subreports do not see parameters

Hi,

I have a problem with linked subreports and passed parameters. The exception from SAP is thrown that some parameter values are missing. Parameters are named exactly the same in the main report and subreport.

CrystalDecisions.CrystalReports.Engine.ParameterFieldCurrentValueException: Missing parameter values. ---> System.Runtime.InteropServices.COMException: Missing parameter values.
   at CrystalDecisions.ReportAppServer.Controllers.ReportSourceClass.Export(ExportOptions pExportOptions, RequestContext pRequestContext)
   at CrystalDecisions.ReportSource.EromReportSourceBase.ExportToStream(ExportRequestContext reqContext)
   --- End of inner exception stack trace ---
   at CrystalDecisions.ReportAppServer.ConvertDotNetToErom.ThrowDotNetException(Exception e)
   at CrystalDecisions.ReportSource.EromReportSourceBase.ExportToStream(ExportRequestContext reqContext)
   at CrystalDecisions.CrystalReports.Engine.FormatEngine.ExportToStream(ExportRequestContext reqContext)
   at CrystalDecisions.CrystalReports.Engine.FormatEngine.Export(ExportRequestContext reqContext)
   at CrystalDecisions.CrystalReports.Engine.ReportDocument.ExportToDisk(ExportFormatType formatType, String fileName)
   at LijsDev.CrystalReportsRunner.Shell.WinFormsReportRunner.Export(Report report, ReportExportFormats exportFormat, String destinationFilename, Boolean overwrite) in D:\work\Projects\CrystalReportsRunner-main\src\LijsDev.CrystalReportsRunner.Shell\WinFormsReportRunner.cs:line 38

Here is the method that returns configured engine:

private static CrystalReportsEngine ConfigureEngine()
    {
      var engine = new CrystalReportsEngine();
      engine.ViewerSettings.AllowedExportFormats =
        ReportViewerExportFormats.PdfFormat |
        ReportViewerExportFormats.ExcelFormat |
        ReportViewerExportFormats.CsvFormat |
        ReportViewerExportFormats.WordFormat |
        ReportViewerExportFormats.RtfFormat |
        ReportViewerExportFormats.ExcelRecordFormat |
        ReportViewerExportFormats.EditableRtfFormat |
        ReportViewerExportFormats.XLSXFormat |
        ReportViewerExportFormats.XmlFormat;

      engine.ViewerSettings.ShowRefreshButton = false;
      engine.ViewerSettings.ShowCopyButton = false;
      engine.ViewerSettings.ShowGroupTreeButton = false;
      engine.ViewerSettings.ShowParameterPanelButton = false;
      engine.ViewerSettings.EnableDrillDown = false;
      engine.ViewerSettings.ToolPanelView = ReportViewerToolPanelViewType.None;
      engine.ViewerSettings.ShowCloseButton = false;
      engine.ViewerSettings.EnableRefresh = false;

      engine.ViewerSettings.SetUICulture(Thread.CurrentThread.CurrentUICulture);

      return engine;
    }

Support for DSN

I really like your library and also works great, but this lacks support for DSN based reports. do you have any plan for that?

Creating your own Runner

I have somehow failed to follow through the instructions. The links provided do not go anywhere. I am not sure how to link depencies to Shell and Runner Core, so i have errors everywhere.

IOrderedQueryable as parameter for SetDataSource

It is possible to use the IOrderedQueryable parameter for SetDataSource as shown in the example: Because I am using EF.

`

Public Overridable Sub SetDataSource(enumerable As IEnumerable)

ByVal tQueryReport As IOrderedQueryable(Of Object),
ByVal tQuerySubReport As IOrderedQueryable(Of Object),

ReportDocument.SetDataSource(tQueryReport.ToList())
ReportDocument.OpenSubreport("SubReport.rpt").SetDataSource(tQuerySubRelatorio.ToList())
`

Exception thrown by Crystal Reports when using English (World) culture

An exception is thrown by Crystal Reports, when computer region is set to English (World) which is 'en-001' IETF tag.

This only happens when parameters are not send to Crystal Reports and the Dialog to input them has to be shown by Crystal Reports itself. At the time of writing this, Runtime version 13.0.34 and previous ones were all affected.

image

Problem while publishing with PublishSingleFile parameter

I currently publishing a application with the following parameters

dotnet publish -c Release --self-contained true -r win-x64 -p:PublishSingleFile=true -p:EnableCompressionInSingleFile=true -o %~dp0publish

An error pop-ups whenever the program calls the Runner

image

I inspected the code behind and it might be missing dependencies or file while doing PublishSingleFile

For more information about the file structure on publish:

image

CrystalReportRunner Folder contents:
image

Tested wIthout any PublishSingleFile parameter and it works fine.

List Of Parameters

Hi,
I cannot in no way send a list of parameters to the report.
In my report i accept a list of numbers, and in dotnet Framework in my other project i would send a array of ints, and work just fine.

Now in here if i just send a number all works fine, if i send a list, array gives an error the values do not match, i've tried everything

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.