Problem saving large file

We have several presentations available for download where first slide contains a placeholder for the presenter’s name and credentials that I am filling in programatically. We have had no problems with this process, except for one large presentation containing approximately 125 slides. When the user tries to download, I am getting the following error:


System.ArgumentException: An entry with the same key already exists. at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource) at System.Collections.Generic.SortedList`2.Add(TKey key, TValue value) at •“.“.›œ(“ rawPart) at •“.“.Še(String partPath, —“ contentType, Byte[] data) at •“.“.Še(String partPath, —“ contentType) at œ’’.„Ÿ›.“Š“(OleObjectFrame oleFrame, “ graphicFrameElementData, ˜œ slideSerializationContext) at œ’’.Ÿ›.“Š“(IShape shape, €“ groupShapeElementData, ˜œ slideSerializationContext, Ÿ› chartPartSerializationContext) at œ’’.Ÿ›.“Š“(IGroupShape groupShape, €“ groupShapeElementData, ˜œ slideSerializationContext, Ÿ› chartPartSerializationContext) at œ’’.ž›.“Š“(IBaseSlide baseSlide, ž“ cSld, ˜œ slideSerializationContext) at œ’’.˜•’.†Š“(ISlide slide) at a’.–’.“(“ package, ISlide slide, –’ serializationContext) at a’.–’.“(IPresentation presentation, ‡ zipFile, ˜Ž outputType, IPptxOptions options) at Aspose.Slides.Presentation.Write(Stream stream, ˜Ž type, IPptxOptions options) at Aspose.Slides.Presentation.Save(Stream stream, SaveFormat format, ISaveOptions options) at Aspose.Slides.Presentation.Save(String fname, SaveFormat format)

I am using Aspose Slides for .NET version 14.6.

Thank you

Can someone please look into this issue? Here is my code to create the presentation:





Try

Dim license As License = New License()
license.SetLicense(“Aspose.Slides.lic”)

Dim thisStr As String

thisStr = “…/presentation.pptx”


Dim pres As New Presentation(thisStr)
Dim sld As Slide
sld = pres.Slides(0)

For Each shp As IShape In sld.Shapes
Dim test As String = shp.AlternativeText
If shp.AlternativeText.Contains(“speaker”) Then
'Change the text of each placeholder
CType(shp, AutoShape).TextFrame.Text = Trim(UserProfile.FullName) & “, " & Trim(UserProfile.msuffix)
End If
If shp.AlternativeText.Contains(“title”) Then
CType(shp, AutoShape).TextFrame.Text = Trim(UserProfile.title)
End If
If shp.AlternativeText.Contains(“affiliation”) Then
CType(shp, AutoShape).TextFrame.Text = Trim(UserProfile.Affiliation)
End If
Next shp


pres.ProtectionManager.SetWriteProtection(“test”)
pres.Save(Server.MapPath(”./") & “presentations” & UserProfile.userID & “.pptx”, Export.SaveFormat.Pptx)


Catch ex As Exception
Response.Write(ex.ToString)
End Try

Hi Scott,


I have observed your comments. Can you please share source presentation so that we can further investigate to help you out. I also like to suggest that before sharing requested document please try to use Aspose.Slides latest version 17.4 on your end.

Best Regards,

Hi Muhammad,


Thanks for your reply. I sent you a private message containing the source presentation.

Hi Scott,

I have tested the presentation file with given sample code on my end and have not been able to observe any issue using Aspose.Slides for .NET 17.4. I have also attached the generated presentation as well. Can you please try Aspose.Slides for .NET 17.4 on your end.



Public Shared Sub TestVb()

Try

Dim thisStr As String = Nothing


thisStr = “SMIT040002.pptx”



Dim pres As New Presentation(thisStr)

'Slide sld = default(Slide);

Dim sld As ISlide = pres.Slides(0)


For Each shp As IShape In sld.Shapes

Dim test As String = shp.AlternativeText

If shp.AlternativeText.Contains(“speaker”) Then

'
Change the text of each placeholder

’ Strings.Trim(UserProfile.FullName) + ", " + Strings.Trim(UserProfile.msuffix);

DirectCast(shp, AutoShape).TextFrame.Text = “speaker”

End If

If shp.AlternativeText.Contains(“title”) Then

Strings.Trim(UserProfile.title);

DirectCast(shp, AutoShape).TextFrame.Text = “title”

End If

If shp.AlternativeText.Contains(“affiliation”) Then

’ Strings.Trim(UserProfile.Affiliation);

DirectCast(shp, AutoShape).TextFrame.Text = “affiliation”

End If

Next



pres.ProtectionManager.SetWriteProtection(“test”)



pres.Save(“Saved.pptx”, Aspose.Slides.Export.SaveFormat.Pptx)

Catch ex As Exception

Console.WriteLine(ex.StackTrace)

End Try


End Sub
Best Regards,