Comments (11)
I was seeing some very slow times using the same AddPicture()
function. It was almost like it would get progressively slower with each call.
However, I recompiled EPPlus to instead use .NET 4.5.2, and this had an immediate 3x speed improvement. FWIW, my report has ~4000 images, one per row, and after making that change it took 6 minutes to create it down from 20 minutes.
Hope this helps!
from epplus.
@romcode is correct the problem is there. Setting the row height kills performance on sheets with a lot of images.
from epplus.
I just added about 6000 small unique images to a spreadsheet in about 17 seconds. Thanks for the update!
P.S. don't forget to dispose your images and bitmaps, I was having really long execution times when I wasn't.
from epplus.
I'm seeing the same issue. It becomes unusable around 1000 small 150x150 images.
from epplus.
Still works very slow when you add many pictures...
from epplus.
I am seeing the same behaviour, it becomes very slow around 400 - 500 images in my case and takes >9 minutes to generate a sheet with around 1100 images in it.
from epplus.
I've been experimenting with a local build of the latest EPPlus and a test program that will add 50, 100, 200, etc small pictures (10-15K each) to a new Excel file.
It looks like the problem is somewhere in the OfficeOpenXml.ExcelRow.set_Height() function.
Here are some performance profiler pictures comparing the 50, 100, 200 image runs. When I go much above that number of images then the captured profile gets too big to work with (many GB in size).
I'm brand new to the EPPlus code/project, so I'm not sure where to look next. I was hoping that given the set_Height() clue, that someone more intimate with the project would know what to look for.
Here is the loop where I add image files to the sheet. The commented out line is the one that kills performance when there is a high number of images in the file. (25 seconds with the height assignment, 3.3 seconds when commented out on 500 images)
foreach (string sFile in listFiles)
{
nRows++;
var img = System.Drawing.Image.FromFile(sFile);
var pic = sheet.Drawings.AddPicture(nRows.ToString(), img);
pic.SetPosition(nRows - 1, 2, nCol, 2);
//sheet.Row(nRows).Height = (img.Height + 4) * 72.0 / 96.0;
}
from epplus.
Optimized the Add method, so It should be a lot faster now. Feel free to try it out
from epplus.
I pulled down the source and rebuilt my local project. I'm seeing slightly faster 'AddPicture' calls, but I'm seeing the same problem as before when I try to adjust the height of the rows that I'm adding pictures to (see the line I had commented out in my example code above).
Is there a source file I can look for to make sure I pull the source that included your update?
from epplus.
Hi, even with the changes of the optimized version ('25 April) I'm experimenting the same problems, as @hbruun noticed, EPPlus is still slow (almost freeze) with excel files with a lot of images (e.g. >1000 ), especially when you try to set the height of the row in order to properly adjust to the image size.
Note that if you don't adjust the row height to be able to content the image, the excel file would be totally illegible by the end user, and also when the excel is sorted by the user, the images aren't properly attached to their cells.
Hoping anyone has a solution or workaround... Thanks!
from epplus.
I have noticed that while AddPicture has improved speed after the latest update - however setting the row and column offset of the picture is getting progressively slower. And when i analysed the source code it seems for each of this property lot of background work is happening writing it on xml.
from epplus.
Related Issues (20)
- INSERTROW System.ArgumentOutOfRangeException HOT 1
- Prevent index out of array bounds exception
- Exporting to excel shows date time value as UTC time while using EPPlus
- What is the status of this project? Is it still active? HOT 23
- NET Core doesn't support SignedCms yet.
- Does EPPLUS support Axis Title font format and series color change in scatterchart
- The type initializer for 'Gdip' threw an exception.Unable to load shared library 'libgdiplus' or one of its dependencies HOT 1
- Sumsq issue HOT 1
- Carriage return not retained
- Row_Delete doesn't delete the whole row
- .Net Core 3.0: use of foreach loop causes Excel file to balloon HOT 2
- Formula Calculation in 4.5.3.3 has bug after calculate call the cell value property return #Value HOT 4
- [NullReferenceException] ResetPageOffset HOT 1
- Don't work PrinterSettings with net core 3.1 HOT 1
- excelWorksheet.InsertRow NullReferenceException HOT 1
- Calculate() breaks the resulting value HOT 9
- Exception on loading xlsx having multiple `_xlnm.Print_Area`
- "Start cell Address must be less or equal to End cell address" Exception
- TokenHandler uses static TokenSeparatorHandler which ignores custom ITokenSeparatorProvider HOT 1
- Property Indexed of class ExcelColorXml always returns 0
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from epplus.