Spire.XLS for .NET is a professional Excel .NET library that can be used to any type of .NET( C#, VB.NET, ASP.NET, .NET Core) application and Java (J2SE and J2EE) application.

Thu Oct 25, 2018 1:47 pm

My code is running fine locally, but when I upload to the test server, I get the following error:

A generic error occurred in GDI+.
---
at System.Drawing.Image.Save(Stream stream, ImageCodecInfo encoder, EncoderParameters encoderParams)
at spr10695.0()
at Spire.Xls.Core.Spreadsheet.XlsWorkbookShapeData.AddPicture(Image image, ImageFormatType imageFormat, String strPictureName)
at spr4322.0(Image A_0, String A_1, ImageFormatType A_2)
at Spire.Xls.Core.Spreadsheet.Collections.XlsPicturesCollection.Add(Int32 topRow, Int32 leftColumn, Image image, ImageFormatType imageFormat)
at Spire.Xls.Collections.PicturesCollection.Add(Int32 topRow, Int32 leftColumn, Image image)
at ccms.Dogberry.Controllers.PrintController.ChecklistToExcel(ChecklistToExcelViewModel model) in C:\Projects\CCMS\CCMS\branches\checklistExport\ccms\ccms.Dogberry\Controllers\PrintController.cs:line 135

So far I have increased the permissions of the .net user in IIS, I've also tried to add Image.Dispose() calls to my code, but when I do, I get this error locally. Here is a snippet of my code:

Code: Select all
                    foreach (var artwork in artworks)
                    {
                      Image thumb;
                      double width, height;

                      sheet.Range[letter + row].Text = " ";

                      if (!string.IsNullOrWhiteSpace(artwork.ThumbnailUrl))
                      {
                        WebClient wc = new WebClient();
                        byte[] bytes = wc.DownloadData(artwork.ThumbnailUrl);
                        MemoryStream ms = new MemoryStream(bytes);
                        thumb = Image.FromStream(ms);

                        width = thumb.Size.Width / 20.0;
                        height = thumb.Size.Height / 4.0;

                        sheet.Pictures.Add(row, columnCount + 1, thumb);


Again this code compiles and runs locally, but I error trying to create the XLS workbook on the last line in the code block provided (which is line 135 from the error). The error happens in my test environment, I have not tried to put this code in production yet.

ryanewing1
 
Posts: 4
Joined: Thu Oct 25, 2018 1:34 pm

Fri Oct 26, 2018 7:49 am

Hello,

Thank you for contacting us.
After an initial test with the latest Spire.XLS Pack(Hotfix) Version:8.10.2, I didn't reproduce your issue. To help us investigate your issue accurately, please share below information. You could send them to us via email (support@e-iceblue.com). Thanks in advance.
1. Your server information, E.g. Server2008.
2. The Region and language, E.g. China, Chinese.
3. Please save the image "thumb" and then send it to us.

Sincerely,
Lisa
E-iceblue support team
User avatar

Lisa.Li
 
Posts: 994
Joined: Wed Apr 25, 2018 3:20 am

Fri Oct 26, 2018 1:34 pm

Thank you, I have sent the email.

ryanewing1
 
Posts: 4
Joined: Thu Oct 25, 2018 1:34 pm

Fri Oct 26, 2018 7:40 pm

I sent a second follow up email. Thanks!

ryanewing1
 
Posts: 4
Joined: Thu Oct 25, 2018 1:34 pm

Mon Oct 29, 2018 6:41 am

Dear Ryan,

Thanks for your more details.
Based on your image, I did notice that there is a GDI+ exception when adding the picture in a sheet. I submitted it to our Dev team for further investigating and fixing. If there is any update, we will let you know immediately. Sorry for the inconvenience caused.

Sincerely,
Lisa
E-iceblue support team
User avatar

Lisa.Li
 
Posts: 994
Joined: Wed Apr 25, 2018 3:20 am

Tue Nov 13, 2018 9:36 am

Dear Ryan,

Thanks for your patient waiting.
We just released the Spire.Office (DLL Only) Version:3.11.3 which fixed the reported issue. Welcome to test it and any feedback will be greatly appreciated.

Sincerely,
Lisa
E-iceblue support team
User avatar

Lisa.Li
 
Posts: 994
Joined: Wed Apr 25, 2018 3:20 am

Return to Spire.XLS