Пример #1
0
        public void GotoPage(int page)
        {
            if (pageTotal < page)
            {
                page = pageTotal;
            }
            try
            {
                PPT.SlideShowView ssv   = objPresSet.SlideShowWindow.View;
                int currentShowPosition = objPresSet.SlideShowWindow.View.CurrentShowPosition;
                ssv.GotoSlide(page);
                int currentShowPosition2 = objPresSet.SlideShowWindow.View.CurrentShowPosition;
                //int clickcount2 = objPresSet.SlideShowWindow.View.GetClickCount();
                //int clickindex2 = objPresSet.SlideShowWindow.View.GetClickIndex();
                int a = 0;
                a++;
                if (currentShowPosition2 != page)
                {
                    Thread.Sleep(1000);
                    ssv.GotoSlide(page);
                    currentShowPosition2 = objPresSet.SlideShowWindow.View.CurrentShowPosition;
                }
                pageCurrent = currentShowPosition2;

                GetCurrentPage();
            }
            catch (Exception e)
            {
                Log.Error("GotoPage excepton: " + e.Message);
            }
        }
Пример #2
0
        public void end()
        {
            if (loaded)
            {
                pres.Close();
                app.Quit();

                sss = null;
                ssw = null;
                ssv = null;

                loaded = false;
                visible = false;
            }
        }
 public void endshow()
 {
     try
     {
         if (Globals.ThisAddIn.Application.ActivePresentation.SlideShowWindow.Active == Office.MsoTriState.msoTrue)
         {
             PowerPoint.SlideShowView view = Globals.ThisAddIn.Application.ActivePresentation.SlideShowWindow.View;
             view.Exit();
             //Globals.ThisAddIn.Application.ActivePresentation.Windows(0).Activate();
         }
     }
     catch (Exception)
     {
         // throw;
     }
 }
        public void gotoSlide(int addcount)
        {
            try
            {
                if (Globals.ThisAddIn.Application.ActiveWindow.Active == Office.MsoTriState.msoTrue)
                {
                    PowerPoint.View         view         = Globals.ThisAddIn.Application.ActiveWindow.View;
                    PowerPoint.Presentation presentation = Globals.ThisAddIn.Application.ActivePresentation;
                    PowerPoint.Slide        slide        = (PowerPoint.Slide)view.Slide;
                    if (slide.SlideIndex + addcount > 0 && addcount <= presentation.Slides.Count)
                    {
                        view.GotoSlide(slide.SlideIndex + addcount);
                    }
                }
            }
            catch (Exception)
            {
                // throw;
            }

            try
            {
                if (Globals.ThisAddIn.Application.ActivePresentation.SlideShowWindow.Active == Office.MsoTriState.msoTrue)
                {
                    PowerPoint.SlideShowView view         = Globals.ThisAddIn.Application.ActivePresentation.SlideShowWindow.View;
                    PowerPoint.Presentation  presentation = Globals.ThisAddIn.Application.ActivePresentation;
                    PowerPoint.Slide         slide        = (PowerPoint.Slide)view.Slide;
                    if (slide.SlideIndex + addcount > 0 && addcount <= presentation.Slides.Count)
                    {
                        view.GotoSlide(slide.SlideIndex + addcount);
                    }
                }
            }
            catch (Exception)
            {
                // throw;
            }
        }
Пример #5
0
        public ppt()
        {
            InitializeComponent();
            // Create an instance of the open file dialog box.
            OpenFileDialog openFileDialog1 = new OpenFileDialog();

            // Set filter options and filter index.
            openFileDialog1.Filter      = "PPT FILES (.pptx)|*.pptx|PPT Files (.ppt)|*.ppt|All Files (*.*)|*.*";
            openFileDialog1.FilterIndex = 1;

            openFileDialog1.Multiselect = true;

            // Call the ShowDialog method to show the dialog box.
            DialogResult userClickedOK = openFileDialog1.ShowDialog();



            // Process input if the user clicked OK.
            if (userClickedOK == DialogResult.OK)
            {
                String file = openFileDialog1.FileName;

                pppt.Application application;

                try
                {
                    // For Display in Panel

                    IntPtr screenClasshWnd = (IntPtr)0;

                    IntPtr x = (IntPtr)0;

                    application = new pppt.Application();

                    presentation = application.Presentations.Open(@file, MsoTriState.msoTrue, MsoTriState.msoTrue, MsoTriState.msoFalse);

                    panel1.Controls.Add(application as Control);

                    sst1 = presentation.SlideShowSettings;

                    sst1.LoopUntilStopped = Microsoft.Office.Core.MsoTriState.msoCTrue;

                    pppt.Slides objSlides = presentation.Slides;

                    sst1.LoopUntilStopped = MsoTriState.msoTrue;

                    sst1.StartingSlide = 1;

                    sst1.EndingSlide = objSlides.Count;

                    panel1.Dock = DockStyle.Fill;

                    sst1.ShowType = pppt.PpSlideShowType.ppShowTypeKiosk;

                    pppt.SlideShowWindow sw = sst1.Run();

                    oSlideShowView = presentation.SlideShowWindow.View;

                    IntPtr pptptr = (IntPtr)sw.HWND;

                    //Gesteur Listener
                    Thread ges = new Thread(new ThreadStart(ges_listen));
                    ges.Start();
                }
                catch (Exception ex)
                {
                    throw;
                }
            }
        }
Пример #6
0
        public int loadFile(String filename)
        {
            //Create app and open file
            app = new PPT.Application();
            pres = app.Presentations.Open(filename, Core.MsoTriState.msoFalse,
                Core.MsoTriState.msoFalse, Core.MsoTriState.msoFalse);

            if (pres == null)
            {
                sss = null;
                ssw = null;
                ssv = null;

                loaded = false;
                visible = false;
                return -1;
            }

            app.Visible = Core.MsoTriState.msoFalse;

            sss = pres.SlideShowSettings;
            sss.ShowType = PPT.PpSlideShowType.ppShowTypeKiosk;
            ssw = sss.Run();
            ssv = ssw.View;

            loaded = true;
            visible = true;
            return pres.Slides.Count;
        }