ClosedXML / ClosedXML/ClosedXML.Report

Slow to export

Open
#341 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
C#
Stars
647
Forks
122
PR merge metrics
No merged PRs in 30d

Description

## Read and complete the full issue template

Do not randomly delete sections. They are here for a reason.

**Do you want to request a *feature* or report a *bug*?**
- [x] Bug
- [ ] Feature
- [ ] Question

**Did you test against the latest CI build?**
- [x] Yes
- [ ] No

If you answered `No`, please test with [the latest development build](https://ci.appveyor.com/project/ClosedXML/ClosedXML/branch/develop/artifacts) first.

**Version of ClosedXML**

v 0.101.0

**Version of ClosedXML.Report**

v 0.2.8

**What is the current behavior?**

I have an Excel template that I turn into a Stream so the data from a grid can export to the template using ClosedXML.Report. I have an array[18000] with about 18000 rows and 8 columns, all just strings from a datagrid. When I export it using ClosedXML, it takes like 5-10mins before it shows me the "Save To" location popup, and the file size is only like 1.3mb. Whereas when the array is 1000 rows, it only takes a couple seconds. I'm not sure if using the ClosedXML.Report for the template has to do with the performance or not, but it does get stuck after template.Generate();

**What is the expected behavior or new feature?**

I was using ClosedXML version 0.95.0 and I expected the performance to increase, but its roughly the same.

**Is this a regression from the previous version?**

See above

## Reproducibility
**This is an important section. Read it carefully. Failure to do so will cause a 'RTFM' comment.**

Without a code sample, it is unlikely that your issue will get attention. Don't be lazy. Do the effort and assist the developers to reproduce your problem. Code samples should be [minimal complete and verifiable](https://stackoverflow.com/help/mcve). Sample spreadsheets should be attached whenever applicable. Remove sensitive information.

**Code to reproduce problem:**
```c#

using ClosedXML.Excel;
using ClosedXML.Report;

var template = new XLTemplate(StreamTemplate); // this is the Excel Template I created, type Stream
SomeArray[] data; // 18000+ rows of data from a grid
template.AddVariable("VariableName", data) // variable is from the Excel template
template.Generate(); // when I debug and step over here, this is where it takes a long time before the 'File save to location' pops up
IXLWorkbook workbook = template.Workbook;
MemoryStream ExcelStream = new();
workbook.SaveAs(ExcelStream);

```

- [ ] I attached a sample spreadsheet. (You can drag files on to this issue)

Thanks!

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.