c# - Workaround or alternative to spreadsheetgear image(chart).GetBitmap()? -


i'm crawling "lots" (100k+) of excel files using spreadsheetgear, found out when spreadsheetgear hits chart lots of points, breaks loose: memory isn't released & takes lot of memory being slow.

for example have 63mb excel file, containing 35 charts 96k points each, getting bitmap each of taking 100mb+ per , not released (at least not untill close worksheet). if let program run on charts end >9gb commited! , definately can't ask customers upgrade 32gb+ required support files.

are there alternatives doing this? i'd fine skipping files slow & tried (checking count on points in seriescollection) seems points access issue didn't (just checking points.count seems load points associated data!).

any appreciated, either able grab graph in alternate way (with spreadsheetgear or library doesn't require installed , supports excel file formats) or way check graphs have many points without using points.count.

it's bit of wild shot asking specific i'm lost there.

not same problem had sorts of trouble trying keep spreadsheet gear chart images in context in our mvc applications , decided go method charts saved onto server png image , recalled server view.

this code save excel chart on server , retrieve in razor view:

<!-- language: lang-cs --> // image spreadsheet spreadsheetgear.shapes.ishape chart7 = worksheet.shapes["chart 7"]; spreadsheetgear.drawing.image image7 = new spreadsheetgear.drawing.image(chart7); savechartimage(image7, "chart7.png");  //save chart images server private void savechartimage(spreadsheetgear.drawing.image image, string chartname) {     var imagefile = system.io.path.combine(imagepath, chartname);     system.drawing.image bitmap = image.getbitmap();     bitmap.save(imagefile, system.drawing.imaging.imageformat.png); }  // action result image     public actionresult getimage(string imagedir, string filename) {     var file = filename;     var fullpath = path.combine(imagedir, file);     return file(fullpath, "image/png", file); } 

retrieve image in view:

<img src="@url.action("getimage", new { imagedir = "~/images/" "filename = "chart7.png" })" /> 

we have used method on large , complex spreadsheets (6 - 8mb). code calls images 16 scatter charts 400+ data points. these charts 16kb on server , far can tell save / retrieve time limited internet connection rather server.

the downside of method doesn't cater multi-user environment. need create user sessions , give charts names unique user.


Comments

Popular posts from this blog

html5 - What is breaking my page when printing? -

html - Unable to style the color of bullets in a list -

c# - must be a non-abstract type with a public parameterless constructor in redis -