A
A
aamaster2018-10-14 14:52:48
ASP.NET
aamaster, 2018-10-14 14:52:48

Correct implementation of generating excel reports in the .NET environment?

Good day.
Task. Scheduled generation of excel files (reports), reports are stored in a folder, reports are available to users from the WEB-application interface. Report data is sent to a certain group of users.
As implemented now. The console application (launched by the Windows scheduler) generates the necessary excel files in turn, Microsoft.Office.Interop.Excel is used, after all the files are generated in the same application, the method that produces the mailing list is launched.
Problem.Microsoft.Office.Interop.Excel is very slow. It takes 10 minutes to generate one file (20,000 lines, 15 columns). Accordingly, it takes several hours to generate 30 such reports. I set temporary markers, it is Microsoft.Office.Interop.Excel (var reader = command.ExecuteReader();) that works slowly, SQL query and other logic work very quickly.
Hidden problem. I suspect that the solution of this problem in this way is not architecturally correct.
Questions.
1. All libraries in .net form exel files so slowly? Or are there libraries that work much faster (eg EPPlus, OpenXML)?
2. Does the described approach to solving this problem take place?
3. What would you recommend to solve this problem? (You may need to use other technologies, for example, sql reporting services).

Answer the question

In order to leave comments, you need to log in

4 answer(s)
B
bullock, 2018-10-14
@bullock

OpenXML is very fast but there is a lot of different low-level nonsense that is unlikely to be needed, although if you figure it out it will be the fastest option, otherwise, either EPPlus or ClosedXml would be a good choice.

K
KillReal, 2018-10-17
@KillReal

Most likely, the code for generating excel files is written crookedly.
I have a sheet of 300k with 14 columns + several light sheets through Interop.Excel, it takes a few seconds to form. Well, less than a minute.
How is data inserted into a sheet?

A
aamaster, 2018-10-20
@aamaster

Thanks for answers. Configured through EPPlus. Works very fast, generates three large files in 10 seconds.
And templates are generally something super-cool.
At the moment, the task described in the question is being solved through EPPlus, it seems, without problems. But still, if anyone has thoughts (experience) about points 2 and 3, it will be very curious.

8
8vaid8, 2018-11-13
@8vaid8

If you are interested in report generators, you can try using FastReport.Net/FastReport.Desktop. The first option can be embedded in a web application on ASP.Net / Core, the desktop can, like your console application, generate reports on a schedule. Plus, it will be easier to create report templates: there is a graphic designer, there is a mailing list, in telegrams, etc. Well, exports, except for excel, for example, PDF, Word, etc.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question