Create report in class library

Stimulsoft Reports.NET discussion
User avatar
ProIT
Posts: 28
Joined: Thu Oct 17, 2013 8:10 am
Location: Muttenz

Create report in class library

Post by ProIT »

Hi there

I use Quartz.NET to run a task every 4 hours. So I created a class library with the job. In this job I need to create a report and export it as pdf.

Output type: Class library
Target framework: .NET 4.0
Referenced assemblies:
- Stimulsoft.Base
- Stimulsoft.Editor
- Stimulsoft.Report
- Stimulsoft.Report.Check
- Stimulsoft.Report.Design
- Stimulsoft.Report.Helper

Here my code to create the StiReport Object:

Code: Select all

//Create Report
StiReport report = new StiReport();
                                               
//load report layout
if (File.Exists(Path.Combine(Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location), "GasOrderLayout.mrt")))
{
  report.Load(Path.Combine(Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location), "GasOrderLayout.mrt"));
}
else
{
  logger.Error("Unable to load report layout");
}
//Load datasource
report.RegBusinessObject("Orders", orders);
report.Dictionary.SynchronizeBusinessObjects();
//Create report
report.Render(false);
However I can't create a report. Every time I try to run the job it crashes at the following line:

Code: Select all

StiReport report = new StiReport();
Image

Isn't it possible to create a report in a class library?

Thanks for any help!
Mike Hachen
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Create report in class library

Post by HighAley »

Hello, Mike.

It's possible to create a report in a class library.
We didn't test our product with Quartz.NET. How do you run this task? Could you send us any sample?

Thank you.
User avatar
ProIT
Posts: 28
Joined: Thu Oct 17, 2013 8:10 am
Location: Muttenz

Re: Create report in class library

Post by ProIT »

Hello Aleksey

Thank you for your reply. I have made a zip file with a sample solution. http://www.proitag.ch/public/sti/StiReportsSolution.zip

In this sample I don't use Quatz.NET but I guess that Quatz.NET isn't relevant for this problem.

Thank you for your help!
Mike Hachen
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Create report in class library

Post by HighAley »

Hello, Mike.

Sorry, but we couldn't reproduce your issue.
Your project works right without any error.
We have got the report exported to PDF.

Thank you.
User avatar
ProIT
Posts: 28
Joined: Thu Oct 17, 2013 8:10 am
Location: Muttenz

Re: Create report in class library

Post by ProIT »

Hello Aleksey

ok, that's strange... I use version 2013.2.1700 of your report engine (as trial version) in Visual Studio 2013 Premium. Could that be the problem?

Thanks, Mike Hachen
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Create report in class library

Post by HighAley »

Hello.

We run your project in Visual Studio 2013 with our latest and 2013.2.1700 assemblies. There wasn't any error.
What error do you get running this project? Please, send us full error stack.

Thank you.
User avatar
ProIT
Posts: 28
Joined: Thu Oct 17, 2013 8:10 am
Location: Muttenz

Re: Create report in class library

Post by ProIT »

Hello Aleksey

There was no error stack. The only error message I got was "vshost.exe has stopped working".

I downloaded your latest version and now it works like a charm!

Thank you for your help.
Mike Hachen
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Create report in class library

Post by HighAley »

Hello, Mike.

Great!
Let us know if you have any problems with our product.

Thank you.
User avatar
ProIT
Posts: 28
Joined: Thu Oct 17, 2013 8:10 am
Location: Muttenz

Re: Create report in class library

Post by ProIT »

Hi there

I updated to the latest Version of your product and now I have the same issue again! I'm not able to create an object of StiReport. I always get a message: "vshost.exe has stopped working".

So what can be the problem? I uninstalled Stimulsoft, reinstalled Stimulsoft, cleaned all directories without any success... I tried the same on a different pc, same result! Any ideas?

Thank you, Mike
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Create report in class library

Post by HighAley »

Hello.

Could you specify what configuration do you run the project with?
Sorry but we couldn't reproduce your issue.
What version of Windows do you use? 32 or 64 bit?

We have found this advice on the MSDN Forum:
Under project properties, please "enable unmanaged code debugging" and try .
Thank you.
Post Reply