Merging/Cloning more than 50MB files

Hi,


In one of the requirement, we have to merge all the slides from about 30 pptx files into a single pptx file.

It works for few pptx files, but when i try for more than 10MB pptx file, it is throwing the below error.

Description

An entry with the same key already exists.

StackTrace

at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource)
at System.Collections.Generic.SortedList`2.Add(TKey key, TValue value)
at ™ˆ.Š.„Ž( rawPart)
at ™ˆ.Š.Ÿ(String partPath, ›ˆ contentType, Byte[] data)
at ..e(OleObjectFrame oleFrame, ” graphicFrameElementData, slideSerializationContext)
at ..e(IGroupShape groupShape, „Ž groupShapeElementData, slideSerializationContext, ‹Ÿ chartPartSerializationContext)
at .™Ÿ.e(IBaseSlide baseSlide, ” cSld, slideSerializationContext)
at ..e(ISlide slide)
at .ˆ.(Š package, ISlide slide, ‡ serializationContext)
at .ˆ.(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)
at buttonClick

Hi Raghupathi,


Thanks for inquiring Aspose.Slides.

I have observed the requirements shared and request you to please share the sample project along with source presentation files. In my opinion, the issue is with Aspose.Slides in working with a presentation that you are trying to clone. Please share the requested information so that I may help you further in this regard.

Many Thanks,

Hi,

Unfortunately, i cannot share the pptx fies that i am using for merging as the data is strictly confidential.

Attached the code snippet that i am using from Aspose & using the latest Aspose.Slides for .Net dll.

protected

void ButtonMergePPTAspose_Click(object sender, EventArgs e)

{

try

{

SPWeb oWeb = SPContext.Current.Web;

int maxDeptCount = 0;

maxDeptCount = GetCountOfPresentations(

Constants.listnamePresentations, oWeb);

SPFile spFileTemplate = oWeb.Site.RootWeb.GetFile(oWeb.Site.Url + Constants.templateUrl);

Stream mergedPresentationTemplate = spFileTemplate.OpenBinaryStream();

Aspose.Slides.

Presentation destinationPresentation = new Aspose.Slides.Presentation();

for (int i = 0; i < maxDeptCount; i++)

{

SPListItem splistitemPresentation = GetListItemByOrder(Constants.listnamePresentations, i + 1, oWeb);

if (splistitemPresentation != null)

{

if (splistitemPresentation.Attachments.Count > 0)

{

if (Convert.ToDateTime(splistitemPresentation["Month"].ToString()).Month == DateTime.Now.Month)

{

SPFile file = splistitemPresentation.ParentList.ParentWeb.GetFile(splistitemPresentation.Attachments.UrlPrefix + splistitemPresentation.Attachments[0].ToString());

Stream pptFile = file.OpenBinaryStream();

Aspose.Slides.

Presentation sourcePresentation = new Aspose.Slides.Presentation(pptFile);

foreach (Aspose.Slides.Slide slide in sourcePresentation.Slides)

{

destinationPresentation.Slides.AddClone(slide);

}

}

}

}

}

string fileStamp = DateTime.Now.ToString("yyyyMMddHHmmssfff");

destinationPresentation.Save(

@"C:\\Temp\PPT" + fileStamp + ".pptx", Aspose.Slides.Export.SaveFormat.Pptx);

destinationPresentation.Save(

@"C:\\Temp\PPT" + fileStamp + ".pdf", Aspose.Slides.Export.SaveFormat.Pdf);

}

catch (ThreadAbortException ex)

{

}

catch (Exception ex)

{

Helper.LogException(ex, Constants.applicationName, SPContext.Current.Web);

}

}

Hi Raghupathi,

I am sorry for your inconvenience. I have observed the sample code shared and it seems OK. You have also followed in live chat session as well. I have some suggestions in this regard. Theoretically, there is no constraint of license version for number of slides to get cloned in target presentation. The evaluation copy is real version but it inserts a watermark in the generated presentation slides. In order to verify this you can shuffle the order of presentations during merging and see if the same presentation throws the issue stated during slide cloning or not. You can also use a try catch block and capture information that for which presentation and which slide the exception is thrown while merging.

I suggest you to please try using 30 days free license to evaluate the product on your end. If there is still an issue you are more than welcome for that and we will try our best to help yo in this regard. However, we will request you to please share the sample solution along with sample presentations with us with which you are able to reproduce the issue. We will also try to reproduce the same on our end to help you further in this this regard. You can mark this thread private and share the presentations with us. When marked private then only you and Aspose staff has access to your information. You can also share the presentation files privately with me by following these guidelines as well. In this case, please simply notify me in this thread that you have shared the presentations privately with me.

Please share, if I may help you further in this regard.

Many Thanks,

Hi, thanks for your reply.

I did use the 30day trial license, it has merged without any watermark. But i am still facing the same issue.

I am able to figure out the below points, so that it might help you further to analyze.

The exception is not occuring at the time of cloning. It is occuring at the time of saving the merged presentation as pptx. The same merged presentation is successfully saving as pdf.

destinationPresentation.Save(@"C:\\Temp\PPT" + fileStamp + ".pptx", Aspose.Slides.Export.SaveFormat.Pptx);

The presentations are strictly confidential & client is not keen to share the presentations. I am trying to see if the same error occurs for the junk data pptx & if i am able to reproduce, will share the solution & files.

We are kind of running out of time for production deployment, so could you please look into this issue?

We got the approval for buying the license, once this issue is fixed. Appreciate your help on this.

Hi,

One more observation is, the merged presentation is saving as ppt but without charts. I am not able to find charts on the merged presentation but am able to see the charts on pdf file.

Hi Raghupathi,


I have verified the comments shared by you. It seems that there is issue with Aspose.Slides while saving the cloned presentation. Unfortunately, it is not possible for me to help you further in this regard without availability of requested information. Its possibly a bug and need to be reported in our issue tracking system. But we need sample code and presentation files used in this regard to fix it. Secondly, I suggest you to please try saving presentation as PPTX. Does this create a issue as well.


Many Thanks,