From: Asian on
Hello,
I'd like to run PowerPoint slideshow with animation ON in my automation code.
I'd like to move the animation one by one, since I'd like take a screen shot
one by one.

Environment:
• Visual Studio 2008 (using PIA (Microsoft.Office.Interop.PowerPoint))
• Office2007
• C#

Now I can run slideshow and move one slide to next slide with Animation OFF.
But it will be crashed if I replace false to True as follows.
// objSSS.ShowWithAnimation = Microsoft.Office.Core.MsoTriState.msoFalse;
objSSS.ShowWithAnimation = Microsoft.Office.Core.MsoTriState.msoTrue;

How can I move animation one by one in slideshow?
And how can I count animation count? I'd like to know how many times I
should loop.

My current code is as follows:
int nSlides = objPres.Slides.Count;

objSSS = objPres.SlideShowSettings;

Animation objSSS.ShowWithAnimation =
Microsoft.Office.Core.MsoTriState.msoTrue; //Replaced with the following line
--> And crash
//Animation objSSS.ShowWithAnimation =
Microsoft.Office.Core.MsoTriState.msoFalse;

objSSS.RangeType =
Microsoft.Office.Interop.PowerPoint.PpSlideShowRangeType.ppShowAll;
objSSS.ShowType =
Microsoft.Office.Interop.PowerPoint.PpSlideShowType.ppShowTypeSpeaker;
objSSS.LoopUntilStopped = Microsoft.Office.Core.MsoTriState.msoFalse;
objSSS.AdvanceMode =
Microsoft.Office.Interop.PowerPoint.PpSlideShowAdvanceMode.ppSlideShowManualAdvance;

objSlides = objPres.Slides;
int[] SlideIdx = new int[nSlides];
for (int ii = 0; ii < nSlides; ii++)
{
SlideIdx[ii] = ii + 1;
}
objSldRng = objSlides.Range(SlideIdx);
objSST = objSldRng.SlideShowTransition;
objSST.AdvanceOnTime = Microsoft.Office.Core.MsoTriState.msoFalse;
objSST.EntryEffect =
Microsoft.Office.Interop.PowerPoint.PpEntryEffect.ppEffectNone;
objSST.Hidden = MsoTriState.msoFalse;

objSSW = objSSS.Run();

objSSWs = PowerpointApplication.SlideShowWindows;

for (int isl = 1; isl <= nSlides; isl++)
{
// <Snip Capture screenshot code>

//move to next slide (I'd like to move to next animation)
objSSWs[1].View.Next();
}
}

Thanks in advance.
 | 
Pages: 1
Prev: .wav file issue
Next: MS Power Point