When I create a new presentation and copy the slides of two already existing presentations I receive an “An entry with the sam key already exists.” exception while saving the new presentation as PPTX.
I use the Aspose.Slides .NET, in the Version 17.3.0 everything works fine but in 17.4.0, 17.5.0 and 17.6.0 the exception occurs
This is my code:
string presDir = @"C:\Data\test\";
Presentation outputPres = new Presentation();
for (int i = 1; i <= 2; i++)
{
Presentation inputPres = new Presentation(presDir + i + ".pptx");
foreach(ISlide slide in inputPres.Slides)
outputPres.Slides.AddClone(slide);
}
outputPres.Save(presDir + "output.pptx", SaveFormat.Pptx);
This is the Stack Trace:
at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource)
at System.Collections.Generic.SortedList2.Add(TKey key, TValue value) at Aspose.Slides. . ( ) at Aspose.Slides. . (String , , , Byte[] ) at Aspose.Slides. . . ( , ) at Aspose.Slides. . (List
1 , , , , )
at Aspose.Slides. . ( , , )
at Aspose.Slides. . (IPresentation )
at Aspose.Slides. . (IPresentation , , PresentationTypeEx , IPptxOptions )
at Aspose.Slides.Presentation. (Stream , PresentationTypeEx , IPptxOptions )
at Aspose.Slides.Presentation.Save(Stream stream, SaveFormat format, ISaveOptions options)
at Aspose.Slides.Presentation.Save(String fname, SaveFormat format)
at RePpServ.Service.Main(String[] args) in C:\Data\repos git\RePowerPointService\RePowerPointService\Service.cs:line 66
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()