Aspose.slides not handling some default office templates


#1

Hello,

Aspose.Slides v2.4.5.0 doesn't seem to handle some of the .POT files that ship out with Microsoft Office 2003. This test shows copying a slide from the POT along with the master to a new, single slide presentation. Once the POT slide is copied to the new presentation, the existing slide is changed to use the master defined by the POT slide. However, this fails with the exception message "Slide is not a master slide". This code works for some of the POTs that ship with MS Office 2003, but not all. An example POT that fails is the one named "Brainstorming Session". Here is the code that illustrates the problem:

static void Main(string[] args)

{

try

{

License lic = new License();

lic.SetLicense("Aspose.Slides.lic");

Presentation empty = new Presentation();

Presentation template = new Presentation("c:\\program files\\microsoft office\\templates\\1033\\brainstorming session.pot");

Slide newSlide = empty.AddTitleSlide();

Slide srcSlide = template.Slides[template.Slides.LastSlidePosition];

SortedList masters = new SortedList();

Slide cloneSlide = template.CloneSlide(srcSlide, empty.Slides.LastSlidePosition + 1, empty, masters);

newSlide.ChangeMaster(cloneSlide, false); // this fails...

}

catch( Exception ex )

{

System.Console.WriteLine(ex.Message);

}

}

Is this a bug, or am I doing something wrong?

Thank you

Mark


#2

You try to use normal slide as master slide.
What slide you clone from POT file? Master or normal slide?

Probably you should write:
newSlide.ChangeMaster(empty.GetSlideById(cloneSlide.MasterId), false);