Spire.XLS is a professional Excel API that enables developers to create, manage, manipulate, convert and print Excel worksheets. Get free and professional technical support for Spire.XLS for .NET, Java, Android, C++, Python.

Mon Feb 18, 2019 4:38 pm

Hi there,
I'm trying to replace some picture in an excel files with some others but it's not working.
Can someone help me?
Thanks

Code: Select all
ExcelSpire.Workbook workbook = new ExcelSpire.Workbook();
                workbook.LoadFromFile(fo.mFile.FullName);
                foreach (ExcelSpire.Worksheet w in workbook.Worksheets)
                {
                    if (!w.HasPictures)
                        continue;
                    int ipic = 0;

                    List<ExcelSpire.Core.IPictureShape> pics = w.Pictures.ToList();
                    for (int ip = 0; ip < w.Pictures.Count; ip++)
                    {
                        ExcelSpire.ExcelPicture p = w.Pictures[ip];
                        if (p.ShapeType != ExcelSpire.ExcelShapeType.Picture)
                            continue;
                        try
                        {
                           
                                string fileT = @"my file"
                                p.Picture = Image.FromFile(fileT);
                   
                        }
                        catch (Exception ex)
                        {
                            mExceptions.Add(new Exception(fo.mFile.FullName, ex));
                        }
                    }
                }
Attachments
FOA CH 2(LUMID060) 03-06-2018 18h00m41s.zip
(338.05 KiB) Downloaded 188 times

codustel
 
Posts: 2
Joined: Mon Feb 18, 2019 2:15 pm

Tue Feb 19, 2019 4:02 am

Hello,

Thanks for your iqnuiry.
I have noticed that the images were not replaced correctly in generated Excel file. The issue has been posted it to our Dev team for further investigation, if there is any good news, we will notify you immediately. Sorry for the inconvenience caused.

Sincerely,
Nina
E-iceblue support team
User avatar

Nina.Tang
 
Posts: 1187
Joined: Tue Sep 27, 2016 1:06 am

Tue Feb 19, 2019 10:58 am

Hello,
Thanks for your reply.
Ok, I hope to have a quick solution to this.
Regards

codustel
 
Posts: 2
Joined: Mon Feb 18, 2019 2:15 pm

Wed Mar 13, 2019 10:36 am

Hi,

Glad to inform you that the reported issue has been fixed. Welcome to download the hotfix from the following link.
Website link: Spire.XLS Pack(Hotfix) Version:9.3.4
Nuget link: https://www.nuget.org/packages/Spire.XLS/9.3.4

Sincerely,
Nina
E-iceblue support team
User avatar

Nina.Tang
 
Posts: 1187
Joined: Tue Sep 27, 2016 1:06 am

Fri Mar 15, 2019 7:04 am

Hi,

Greetings from E-iceblue.
Did you test the hotfix? Has your issue been resolved?
Thanks in advance for your valuable feedback and time.

Yours sincerely,
Nina
E-iceblue support team
User avatar

Nina.Tang
 
Posts: 1187
Joined: Tue Sep 27, 2016 1:06 am

Return to Spire.XLS