Hi,
I am creating an automation for creating power point presentation using VSTO and C#. I have create a slide show (with background music). Now I have to export this slide show to a video file. I have successfully create video, but it doesn't have the sound effect.
I write code like this:
void createPPT()
{
using PowerPoint = Microsoft.Office.Interop.PowerPoint;
PowerPoint.Application objApp;
PowerPoint.Presentations objPresSet;
PowerPoint._Presentation objPres;
PowerPoint.Slides objSlides;
PowerPoint._Slide objSlide;
PowerPoint.TextRange objTextRng;
PowerPoint.Shapes objShapes;
PowerPoint.Shape objShape;
PowerPoint.SlideShowWindows objSSWs;
PowerPoint.SlideShowTransition objSST;
PowerPoint.SlideShowSettings objSSS;
PowerPoint.SlideRange objSldRng;
objApp = new PowerPoint.Application();
objPresSet = objApp.Presentations;
objPres = objPresSet.Open(strStrTemplate, MsoTriState.msoFalse,
MsoTriState.msoTrue, MsoTriState.msoFalse);
objSlides = objPres.Slides;
for (int i = 0; i < SlideList.Count; ++i)
{
objSlide = objSlides.Add(i + 1, PowerPoint.PpSlideLayout.ppLayoutBlank);
objSlide.Shapes.AddPicture(StrImagePath, MsoTriState.msoFalse, MsoTriState.msoTrue, 5, 5, 950, 530);
objSldRng = objSlides.Range(i + 1);
objSST = objSldRng.SlideShowTransition;
objSST.AdvanceOnTime = MsoTriState.msoTrue;
objSST.AdvanceTime = 5;
}
objSldRng = objSlides.Range(1);
objSST.SoundEffect.ImportFromFile(@"D:\Songs\BGM1.wav");
objSST.LoopSoundUntilNext = MsoTriState.msoTrue;
objSSS.Run();
objPres.CreateVideo(strSavePath, true, 0,640, 60, 100);
}
Please help me to create video with background music.
Also, This code work with only .wav files. Can I use other sound formates also??
Thanks in advance..