Spire.Presentation is a professional PowerPoint® compatible library that enables developers to create, read, write, modify, convert and Print PowerPoint documents. Get free and professional technical support for Spire.Presentation for .NET, Java, Android, C++, Python.

Thu May 26, 2022 1:16 pm

I am using Spire.Office (v5.2.0). I am trying the below HTML content to be presented into PowerPoint

<HTML><BODY><div><img src='155-200x200.jpg' /><p>The tool is used automate the process, improve coordination and communication, increase visibility, and reduce human effort. The key features of tool are:<br /><ul><li>Automatically identifies tasks ready to be executed</li><li>Cutover plan management in MS project with built-in sync</li><li>Automatically notifies task readiness for team members</li><li>Built-in security in accordance with internal audit</li><li>Scalable reporting</li></ul></p><table width='0' class='mce-item-table'><tbody><tr><td><b>D-DASH Team</b></td><td>Email: <a href='mailto:team@mail.com'>team@mail.com</a></td></tr><tr><td><b>Person</b></td><td>Managing Director<br />Email: <a href='mailto:team@mail.com'>team@mail.com</a></td></tr></tbody></table></div></BODY></HTML>

Code:
Presentation ppt = new Presentation();
ShapeList shapes = ppt.Slides[0].Shapes;
shapes.AddFromHtml(htmlString);
ppt.SaveToFile(outputFilename, FileFormat.Pptx2013);


The line 'shapes.AddFromHtml(htmlString)' is throwing the following expectation:

System.ArgumentException
HResult=0x80070057
Message=An item with the same key has already been added. Key: td:0|1
Source=System.Private.CoreLib
StackTrace:
at System.ThrowHelper.ThrowAddingDuplicateWithKeyArgumentException[T](T key)
at System.Collections.Generic.Dictionary`2.TryInsert(TKey key, TValue value, InsertionBehavior behavior)
at spr䚷.ᜂ(ArrayList A_0, Char[] A_1)
at spr䚷.ᜃ(Char[] A_0, Int32 A_1, Int32 A_2)
at Spire.Presentation.Collections.ShapeList.ᜀ(String A_0, spr䚴 A_1, String A_2)
at Spire.Presentation.Collections.ShapeList.AddFromHtml(String htmlText)
at EmbedHtmlString.AppendHtmlString.CreatePPTWithImage(String htmlString, String outputFilename) in D:\02-SourceCode\EmbedHtmlString\EmbedHtmlString\AppendHtmlString.cs:line 24
at Program.<Main>$(String[] args) in D:\02-SourceCode\EmbedHtmlString\EmbedHtmlString\Program.cs:line 13

Can you please look into this and what is the reason for this exception. Thank you in advance.

SudhiHebbar
 
Posts: 5
Joined: Thu May 26, 2022 12:56 pm

Fri May 27, 2022 3:50 am

Hello,

I tested your code separately with Spire.Office v5.2.0 and the latest version 7.4.10. I did get an exception (System.ArgumentOutOfRangeException) but not the one you encountered. Anyway I have logged this issue in our bug tracking system with the ticket SPIREPPT-1963. If there is any update, I will notify you in time.
Sincerely,
Andy
E-iceblue support team
User avatar

Andy.Zhou
 
Posts: 483
Joined: Mon Mar 29, 2021 3:03 am

Fri Jul 08, 2022 8:44 am

Hello,

Thanks for your patience!

Glad to inform you that we just released Spire.Office Version:7.7.2 which fixes your issue SPIREPPT-1963.

Please download the new version from the following links to test.
Website link:
https://www.e-iceblue.com/Download/down ... t-now.html
Nuget link:
https://www.nuget.org/packages/Spire.Office/7.7.2
https://www.nuget.org/packages/Spire.Of ... dard/7.7.2
Sincerely,
Andy
E-iceblue support team
User avatar

Andy.Zhou
 
Posts: 483
Joined: Mon Mar 29, 2021 3:03 am

Return to Spire.Presentation