Free Support Forum - aspose.com

.potx file as template for generating .pptx using Aspose.SlideEx

Hi Team,


I am trying to use PPT template file (.potx) for creating slides using Aspose.SlideEx.

I get corrupted file as output when i save the generated PPT (in .pptx format).

Please let me know how can i solve this issue.

I already tried to covert .potx to .pptx and later generating pptx, it doesn’t work.

Find attachment for detail.

Thanks and Regards,
Nakul

Hi Nakul,

Thanks for inquiring Aspose.Slides.

Please share the sample code snippet that you have used to reproduce the issue along with generated corrupted presentation for our reference. I will try to reproduce the issue on my end to help you further in this regard.

Many Thanks,

Code snipped is simple and straightforward,


// To load template file
ProcessingPresentation = new PresentationEx(documentStream, new LoadOptions() { LoadFormat = LoadFormat.Auto });

// To save generated file
ProcessingPresentation.Write(presentationStream);

As well for Potx templte i tried to convert to pptx and then generate document.

// PresentationEx potExDoc = new PresentationEx(documentStream, new LoadOptions() { LoadFormat = LoadFormat.Auto });
// Stream outPutStream = new MemoryStream();
// potExDoc.Save(outPutStream, Aspose.Slides.Export.SaveFormat.Potx);
// ProcessingPresentation = new PresentationEx(outPutStream, new LoadOptions() { LoadFormat = LoadFormat.Auto });

Thanks and regards,
Nakul

Hi Nakul,


I have worked with the presentation file shared by you using Aspose.Slides for .NET 6.6.0 with the following code and have not been able to generate any corrupt presentation. Can you please try using the following code with mentioned version of Aspose.Slides for .NET.

// To load template file
PresentationEx ProcessingPresentation = new PresentationEx(path+“Default MSPPT_potx.potx”);
// To save generated file
ProcessingPresentation.Write(path+“Default MSPPT_potx2.pptx”);


Many Thanks,

Hi Mudassir,


I have reviewed ,y code and tried to use as suggested by you.
I have difference in below line

public byte[] SavePresentation()
{
try
{
using (MemoryStream presentationStream = new MemoryStream())
{
ProcessingPresentation.Write(presentationStream);
}
return presentationStream.ToArray();
}
}
catch (Exception)
{
throw;
}
}
;
;
;
;
File.WriteAllBytes(@“Output/Default MSPPT_potx.pptx”, slides.SavePresentation());

I have to return bytes as i need to store generated pptx in database/ or over network.

Please try to use above 2 line to save document on disk.

If you change file extension from .pptx to .potx it is opening properly.
Hope you are clear about cause of issue.

Please find attached screenshot for error.

If you note the bytes written to memorystream and filestream, difference is 2KB.

Thanks and regards,

Hi Nakul,


I have observed the code snippet shared by you and it seems you are not setting the position of memory stream to 0 after file is written in memory stream. You need to add the following code snippet in your code and hopefully things will work on your end. Then you need to convert memory stream to byte array.

ProcessingPresentation.Write(presentationStream);
presentationStream.Position=0;

Many Thanks,

Hi Nakul,


I have also generated a sample project based on your input and have investigated the issue in detail. I have observed that when one save the presentation as file there are 59321 bytes written to generated presentation and it opens fine in PowerPoint. However, when presentation is saved to memory stream using Aspose.Slides there are 59324 bytes written and the generated presentation is corrupted. This is where the problem seem to lie. I have created an issue with ID SLIDESNET-33738 in our issue tracking system to further investigate and resolve the issue. This thread has been linked with the issue so that you may be automatically notified once the issue will be resolved.

We are sorry for your inconvenience,
Hi Mudassir,
I have posted this in priority support forum.

http://www.aspose.com/community/forums/415739/showthread.aspx#415739

Thanks and Regards,
Nakul

Hi Nakul,


Thanks for inquiring Aspose.Slides.

I have observed the issue shared by you and like to share that it has been created few days back. Actually, priority support is on halt for Aspose.Slides since due to ongoing auto porting activities for Aspose.Slides for Java. However, I have raised the priority of the issue and have requested our development team to scheduled the issue for resolution earlier than already pending ones. I will share the further response with you as soon as it will be shared by our development team.

Many Thanks,

Hi Team,


Any update on this, we are waiting for fix.

Thanks and Regards,
Nakul

Hi Nakul,


I have verified from our issue tracking system and regret to share that issue shared has not yet been resolved. The issue has been assigned to concerned developer and I have requested him to share the further updates. I will share the further updates with you as soon as it will be shared by them.

Many Thanks,

The issues you have found earlier (filed as SLIDESNET-33738) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.
(2)

Hi Team,


The issue is not fixed,I observe same issue 6.8.0.0 aspose slide version.

The generated slide shapes are out of order.

Please have a look at attached sample.

Thanks and Regards,
Nakul

Hi Nakul,


I have observed the issue shared by you and like to share that I have already created an issue with ID SLIDESNET-33780 in our issue tracking system for this and the issue has also been resolved in Aspose.Slides for .NET 6.9.0. The mentioned product will be released hopefully in coming week and we will share the notification with you as soon as it will be available.

Secondly, I also like to suggest you to please try using PresentationEx.Save() method for saving presentation if you are using Potx file and saving that as PPTX.

Many Thanks,

The issues you have found earlier (filed as SLIDESNET-33780) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.
(2)

Thanks for solution,


Works with Presentation.Save(tostream,PPTX) method.

Presentation.Write() methods gives same error.

Thanks and Regards,
Nakul

Hi Nakul,


I have observed the requirement shared and like to share that Presentation.Write() method is only able to save the presentation in format in which it is read. For example, if you have read a POT file, the Write() method can only save that to POT and not to PPT. If you want to save the format other than source format then you need to use Save method and specify the format. I hope this will clear the concept to you.

Many Thanks,