More on Title Masters


#1

Thanks Alexey four previous reply - but I was a little confused.

I do have a few more questions about how this works - assuming I have a template file with a title master and one blank side - how do I set the first slide to "inherit" from the TitleMaster?

I tried the following but the IF evaluated to false:

_currentSlide = _presentation.GetSlideByPosition(1);

if(_presentation.GetSlideByPosition(0) != null)

{

_currentSlide.MasterId = _presentation.GetSlideByPosition(0).SlideId;

}

As usual - thanks for your help.


#2

For changing master you should use Slide.ChangeMaster function.
But I didn’t even try it with title masters. You can try, in theory it should work.

GetSlideByPosition function doesn’t work for title masters because there are
can be many slides with SlideId equal to 0 so you have to iterate all slides and check Id.


#3

Sorry - I'm still confused here.

Let me rephrase my original question - assuming I have a template that has a single blank slide and contains a "Title Master."

How do I set my first slide to inherit from "Title Master" and all of the following slides to follow the MainMaster? Could you please supply a code sample?


#4

Something like that:

_currentSlide = _presentation.GetSlideByPosition(1);

titleMaster = null;
for (int i = 0; i < _presentation.Slides.Count; i++)
{
if (_presentation.Slides[ i ].SlideId == 0)
{
titleMaster = _presentation.Slides[ i ];
break;
}
}
if (titleMaster != null)
{
_currentSlide.ChangeMaster(titleMaster.SlideId);
}