Free Support Forum - aspose.com

Creating slideshow causes parts of slides to disappear/change

When trying to combine a set of slides into a single slideshow, some slides lose text or other formatting in the process of cloning them into the presentation. Below is the code I’m using to try and accomplish this, and I’ve attached an effected slide and the resulting presentation (consisting of just that slide). This was done using the most recent version of aspose.slides (2.8.5.0). Help would be much appreciated. Thank you.

foreach (string fileName in _sourceFiles)//_sourceFiles is an ArrayList containing locations of individual PowerPoint slides
{
if (File.Exists(fileName))
{
try
{
//aspose makes you declare and supply the SortedList for the CloneSlide method
System.Collections.SortedList sortedList = new System.Collections.SortedList();
Aspose.Slides.Presentation importPres = new Aspose.Slides.Presentation(fileName);
Aspose.Slides.Slide slide = importPres.GetSlideByPosition(1);
importPres.CloneSlide(slide, _newPres.Slides.LastSlidePosition + 1, _newPres, sortedList);
}
catch (Exception ex)
{
_filesSkipped++;
}
}
else
{
_filesSkipped++;
}
_filesProcessed++;
}
_newPres.Slides.RemoveAt(0);
_newPres.Write(_targetFile);//_targetFile contains the destination for the presentation with all the individual slides


Dear hoopscoach,

We will investigate the problem, but I as a workaround, I have recreated the original.pot and attached here as -original.pot. It is working fine, please also see the output of the following code.

Presentation _newPres = new Presentation();

Slide _newSld = _newPres.GetSlideByPosition(1);

Aspose.Slides.Presentation importPres = new Aspose.Slides.Presentation(@"c:\source\-original.pot");

Aspose.Slides.Slide slide = importPres.GetSlideByPosition(1);

System.Collections.SortedList sortedList = new System.Collections.SortedList();

importPres.CloneSlide(slide, _newPres.Slides.LastSlidePosition + 1, _newPres, sortedList);

//remove the default slide

_newPres.Slides.Remove(_newSld);

_newPres.Write("c:\\output.ppt");

Would you please describe what you’ve done in the workaround slide to cause the resulting slide to work? I have many slides that are broken so simply fixing one of the slides for me doesn’t help. Could you also state what you’re trying to show in your example code? As far as I can tell,
your code is identical to mine for the purposes of putting one slide into a slideshow. Thank you!

Actually, I had recreated the template; sometimes source files are broken, when you simply save them back with different name or recreate them in MS-PowerPoint, they work fine.

<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

I am trying to show that you should not use Presentation.Slides.RemoveAt() because it can remove master slide, use the safer one Presentation.Slides.Remove() method.

I’ve tried changing the Presentation.Slides.Remove methods in my code as you recommended. That didn’t resolve the issue. The slide still appears broken when using the Aspose dll. Regarding resaving or recreating the slides, we have hundreds of slides and rebuilding the ones that fail isn’t really an option as we don’t have the resources. Is there another possibilty for how I could fix this behavior or is this a bug with Aspose that will have to wait for another revision? Thanks

Dear hoopscoach,

We will investigate the source of problem and fix it as soon as possible.