Hello,
While trying to insert a clone of a slide with a Hyperlink to a presentation, I encountered an exception thrown:
System.Collections.Generic.KeyNotFoundException: The given key was not present in the dictionary.
To illustrate the issue I have a sample presentation with 2 slides. Slide1 has a hyperlink to Slide 2.
When trying to insert a clone of Slide 1 , I am getting the described error.
Here is a snippet of my code:
string sourceFile = “c:\temp\Slide1-2.pptx”;
var presentation = new Presentation(sourceFile);
var slide1 = presentation.Slides[0];
presentation.Slides.InsertClone(0, slide1);
----
[KeyNotFoundException: The given key was not present in the dictionary.]
System.Collections.Generic.Dictionary`2.get_Item(TKey key) +10715145
..(IHyperlink hyperlink, addHlink, serializationContext) +908
..(IHyperlinkContainer hyperlinkContainer, addHlinkClick, addHlinkMouseOver, serializationContext) +73
..(IPortionFormat portionFormat, addRPr, serializationContext) +2162
.a.(IParagraphCollection paragraphs, addP, serializationContext) +2606
..(ITextFrame textFrame, textBodyElementData, serializationContext) +1223
..(ITextFrame textFrame, addTxBody, serializationContext) +93
..(IAutoShape autoShape, shapeElementData, slideSerializationContext, chartPartSerializationContext) +1136
..(IGroupShape groupShape, groupShapeElementData, slideSerializationContext, chartPartSerializationContext) +1448
..(IBaseSlide baseSlide, cSld, slideSerializationContext) +381
..(ISlide slide) +396
..( package, ISlide slide, serializationContext) +581
..ea(IPresentation destPresentation, ILayoutSlide destLayout, ISlide sourceSlide) +571
Aspose.Slides.SlideCollection.AddClone(ISlide sourceSlide) +276
Aspose.Slides.SlideCollection.InsertClone(Int32 index, ISlide sourceSlide) +50
Aspose 14.4 for .NET 4.0 dll is used.
pptx test file is attached.
Please help to resolve it!
Thank you,
Natasha Turchak
Sr.Developer at Viscira