I’m trying to convert .PPT/.PPTX files to .SWF. But when I call the .Save() method and set specific page, I received the exception: “An unhandled exception of type ‘Aspose.Slides.PptxException’ occurred in Aspose.Slides.dll
Additional information: This export format is not implemented for PPTX yet.“
My source code is:
var pres = new Aspose.Slides.Presentation(file);
for (int i = 0; i < pres.Slides.Count; i++)
{
string fileNameOnly = Path.GetFileNameWithoutExtension(file);
string outputFolder = Path.GetDirectoryName(file);
var swfFilePath = string.Format(”{0}{1}_{2}.swf”, outputFolder, fileNameOnly, (i + 1));
string logInfo = string.Format(“Convert ‘{0}’ to ‘{1}’”, Path.GetFileName(file), Path.GetFileName(swfFilePath));
Console.WriteLine(logInfo + " START AT: " + DateTime.Now.ToString());
FileStream fs = new FileStream(swfFilePath, FileMode.OpenOrCreate);
pres.Save(fs, new int[] { i +1 }, Aspose.Slides.Export.SaveFormat.Swf);
fs.Close();
Console.WriteLine(logInfo + " END AT: " + DateTime.Now.ToString());
}
When I tried to convert entire .PPT file to .SWF, using example in the .NET 16.4.0.0 Release Notes link (at the end of the page). My code is:
using (Presentation pres = new Presentation(file)){SwfOptions swfOptions = new SwfOptions();swfOptions.ViewerIncluded = false;// Saving presentationpres.Save(“output.swf”, SaveFormat.Swf, swfOptions);swfOptions.ViewerIncluded = true;// Saving notes pagespres.Save(“outputNotes.swf”, SaveFormat.SwfNotes, swfOptions);}
but in this case I received the error "An unhandled exception of type ‘System.IndexOutOfRangeException’ occurred in Aspose.Slides.dll
Additional information: Index was outside the bounds of the array. "
I have observed the information shared by you and request you to please provide source presentation with which you are experiencing the issue. I will investigate the issue further on my end to help you further in this regard.
I have worked with the presentation file shared by you and have been able to observe the issue specified. An issue with ID SLIDESNET-37458 has been created 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 fixed.
The second issue (“An unhandled exception of type ‘System.IndexOutOfRangeException’ occurred in Aspose.Slides.dll Additional information: Index was outside the bounds of the array.”) was fixed in version 16.5.0, but another (“An unhandled exception of type ‘Aspose.Slides.PptxException’ occurred in Aspose.Slides.dll Additional information: This export format is not implemented for PPTX yet.”) wasn’t. I tried the same code as the first post in this threadt, but still receiving the same error.
One more thing - Is is possible when convert PPT/PPTX to SWF to keep animations from PowerPoint in the converted file?
I have tested your presentation and shared sample code using Aspose.Slides for .NET 16.5.0. I have successfully been able to create the SWF files on my end. I have also attached them for your reference as well. Can you please share the working sample project along with issue details so that we may investigate the issue further.
I talked about to save each slide to different .SWF files. Here is my simple code:
static void ConvertPPTslidesToSWF(string file) { var pres = new Aspose.Slides.Presentation(file); for (int i = 0; i < pres.Slides.Count; i++) { string fileNameOnly = Path.GetFileNameWithoutExtension(file); string outputFolder = Path.GetDirectoryName(file); var swfFilePath = string.Format("{0}\{1}_{2}.swf", outputFolder, fileNameOnly, (i + 1)); string logInfo = string.Format(“Convert ‘{0}’ to ‘{1}’”, Path.GetFileName(file), Path.GetFileName(swfFilePath)); Console.WriteLine(logInfo + " START AT: " + DateTime.Now.ToString()); FileStream fs = new FileStream(swfFilePath, FileMode.OpenOrCreate); pres.Save(fs, new int[] { i + 1 }, Aspose.Slides.Export.SaveFormat.Swf); fs.Close(); Console.WriteLine(logInfo + " END AT: " + DateTime.Now.ToString()); } Console.WriteLine(""); }
And I received “An unhandled exception of type ‘Aspose.Slides.PptxException’ occurred in Aspose.Slides.dll Additional information: This export format is not implemented for PPTX yet.” error.
Thank you for sharing the feedback. I have worked with sample code shared by you and it seems to be an issue when you are trying to export slide wise swf files. I have reopened the concerned issue and have also updated comments in our issue tracking system. I will share feedback with you as soon as it will be shared by our product team.