public void RunExample() { // start powerpoint PowerPoint.Application powerApplication = new PowerPoint.Application(); // add a new presentation with one new slide PowerPoint.Presentation presentation = powerApplication.Presentations.Add(MsoTriState.msoTrue); PowerPoint.Slide slide = presentation.Slides.Add(1, PpSlideLayout.ppLayoutBlank); // add a chart slide.Shapes.AddOLEObject(120, 111, 480, 320, "MSGraph.Chart", "", MsoTriState.msoFalse, "", 0, "", MsoTriState.msoFalse); // save the document string fileExtension = GetDefaultExtension(powerApplication); string documentFile = string.Format("{0}\\Example05{1}", _hostApplication.RootDirectory, fileExtension); presentation.SaveAs(documentFile); // close power point and dispose reference powerApplication.Quit(); powerApplication.Dispose(); // show dialog for the user(you!) _hostApplication.ShowFinishDialog(null, documentFile); }
private void buttonStartExample_Click(object sender, EventArgs e) { // start powerpoint and turn off msg boxes PowerPoint.Application powerApplication = new PowerPoint.Application(); powerApplication.Visible = MsoTriState.msoTrue; // PowerPoint 2000 doesnt support DisplayAlerts, we check at runtime its available and set if (powerApplication.EntityIsAvailable("DisplayAlerts")) { powerApplication.DisplayAlerts = PpAlertLevel.ppAlertsNone; } // we register some events. note: the event trigger was called from power point, means an other Thread powerApplication.PresentationCloseEvent += new NetOffice.PowerPointApi.Application_PresentationCloseEventHandler(powerApplication_PresentationCloseEvent); powerApplication.AfterNewPresentationEvent += new NetOffice.PowerPointApi.Application_AfterNewPresentationEventHandler(powerApplication_AfterNewPresentationEvent); // add a new presentation with one new slide PowerPoint.Presentation presentation = powerApplication.Presentations.Add(MsoTriState.msoTrue); PowerPoint.Slide slide = presentation.Slides.Add(1, PpSlideLayout.ppLayoutBlank); // close the document presentation.Close(); // close power point and dispose reference powerApplication.Quit(); powerApplication.Dispose(); }
public void RunExample() { // start powerpoint PowerPoint.Application powerApplication = new PowerPoint.Application(); // create a utils instance, no need for but helpful to keep the lines of code low CommonUtils utils = new CommonUtils(powerApplication); // add a new presentation with one new slide PowerPoint.Presentation presentation = powerApplication.Presentations.Add(MsoTriState.msoTrue); PowerPoint.Slide slide = presentation.Slides.Add(1, PpSlideLayout.ppLayoutBlank); // add a chart slide.Shapes.AddOLEObject(120, 111, 480, 320, "MSGraph.Chart", "", MsoTriState.msoFalse, "", 0, "", MsoTriState.msoFalse); // save the document string documentFile = utils.File.Combine(HostApplication.RootDirectory, "Example05", DocumentFormat.Normal); presentation.SaveAs(documentFile); // close power point and dispose reference powerApplication.Quit(); powerApplication.Dispose(); // show end dialog HostApplication.ShowFinishDialog(null, documentFile); }
public void RunExample() { // start powerpoint PowerPoint.Application powerApplication = new PowerPoint.Application(); // add a new presentation with two new slides PowerPoint.Presentation presentation = powerApplication.Presentations.Add(MsoTriState.msoTrue); PowerPoint.Slide slide1 = presentation.Slides.Add(1, PpSlideLayout.ppLayoutBlank); PowerPoint.Slide slide2 = presentation.Slides.Add(1, PpSlideLayout.ppLayoutBlank); // add shapes slide1.Shapes.AddShape(MsoAutoShapeType.msoShape4pointStar, 100, 100, 200, 200); slide2.Shapes.AddShape(MsoAutoShapeType.msoShapeDoubleWave, 200, 200, 200, 200); // change blend animation slide1.SlideShowTransition.EntryEffect = PpEntryEffect.ppEffectCoverDown; slide1.SlideShowTransition.Speed = PpTransitionSpeed.ppTransitionSpeedFast; slide2.SlideShowTransition.EntryEffect = PpEntryEffect.ppEffectCoverLeftDown; slide2.SlideShowTransition.Speed = PpTransitionSpeed.ppTransitionSpeedFast; // save the document string fileExtension = GetDefaultExtension(powerApplication); string documentFile = string.Format("{0}\\Example04{1}", _hostApplication.RootDirectory, fileExtension); presentation.SaveAs(documentFile); // close power point and dispose reference powerApplication.Quit(); powerApplication.Dispose(); // show dialog for the user(you!) _hostApplication.ShowFinishDialog(null, documentFile); }
public TestResult DoTest() { PowerPoint.Application application = null; DateTime startTime = DateTime.Now; try { application = new PowerPoint.Application(); // add a new presentation with one new slide PowerPoint.Presentation presentation = application.Presentations.Add(MsoTriState.msoTrue); PowerPoint.Slide slide = presentation.Slides.Add(1, PpSlideLayout.ppLayoutBlank); // add a chart. MSGraph.Chart is may not installed slide.Shapes.AddOLEObject(120, 111, 480, 320, "MSGraph.Chart", "", MsoTriState.msoFalse, "", 0, "", MsoTriState.msoFalse); return(new TestResult(true, DateTime.Now.Subtract(startTime), "", null, "")); } catch (Exception exception) { return(new TestResult(false, DateTime.Now.Subtract(startTime), exception.Message, exception, "")); } finally { if (null != application) { application.Quit(); application.Dispose(); } } }
/// <summary> /// Return all slide notes /// </summary> /// <param name="slide"></param> /// <returns></returns> // https://stackoverflow.com/a/20640637 private string GetNotes(PowerPoint.Slide slide) { if (slide.HasNotesPage == MsoTriState.msoFalse) { return(string.Empty); } string slideNodes = string.Empty; var notesPage = slide.NotesPage; int length = 0; foreach (PowerPoint.Shape shape in notesPage.Shapes) { if (shape.Type == MsoShapeType.msoPlaceholder) { var tf = shape.TextFrame; try { //Some TextFrames do not have a range var range = tf.TextRange; if (range.Length > length) { //Some have a digit in the text, //so find the longest text item and return that slideNodes = range.Text; length = range.Length; } } catch (Exception) { } } } return(slideNodes); }
public void RunExample() { bool isFailed = false; string documentFile = null; PowerPoint.Application powerApplication = null; try { // start powerpoint powerApplication = COMObject.Create <PowerPoint.Application>(); // create a utils instance, no need for but helpful to keep the lines of code low CommonUtils utils = new CommonUtils(powerApplication); // add a new presentation with one new slide PowerPoint.Presentation presentation = powerApplication.Presentations.Add(MsoTriState.msoTrue); PowerPoint.Slide slide = presentation.Slides.Add(1, PpSlideLayout.ppLayoutBlank); // add new module and insert macro. the option "Trust access to Visual Basic Project" must be set VB.CodeModule module = presentation.VBProject.VBComponents.Add(vbext_ComponentType.vbext_ct_StdModule).CodeModule; string macro = string.Format("Sub NetOfficeTestMacro()\r\n {0}\r\nEnd Sub", "MsgBox \"Thanks for click!\""); module.InsertLines(1, macro); // add button and connect with macro PowerPoint.Shape button = slide.Shapes.AddShape(MsoAutoShapeType.msoShapeActionButtonForwardorNext, 100, 100, 200, 200); button.ActionSettings[PpMouseActivation.ppMouseClick].AnimateAction = MsoTriState.msoTrue; button.ActionSettings[PpMouseActivation.ppMouseClick].Action = PpActionType.ppActionRunMacro; button.ActionSettings[PpMouseActivation.ppMouseClick].Run = "NetOfficeTestMacro"; // save the document documentFile = utils.File.Combine(HostApplication.RootDirectory, "Example03", DocumentFormat.Macros); presentation.SaveAs(documentFile); } catch (System.Runtime.InteropServices.COMException throwedException) { isFailed = true; HostApplication.ShowErrorDialog("VBA Error", throwedException); } finally { // close power point and dispose reference if (powerApplication != null) { powerApplication.Quit(); powerApplication.Dispose(); } if ((null != documentFile) && (!isFailed)) { HostApplication.ShowFinishDialog(null, documentFile); } } }
public TestResult DoTest() { PowerPoint.Application application = null; DateTime startTime = DateTime.Now; try { application = new PowerPoint.Application(); application.Visible = MsoTriState.msoTrue; // PowerPoint 2000 doesnt support DisplayAlerts, we check at runtime its available and set if (application.EntityIsAvailable("DisplayAlerts")) { application.DisplayAlerts = PpAlertLevel.ppAlertsNone; } application.PresentationCloseEvent += new NetOffice.PowerPointApi.Application_PresentationCloseEventHandler(powerApplication_PresentationCloseEvent); application.AfterNewPresentationEvent += new NetOffice.PowerPointApi.Application_AfterNewPresentationEventHandler(powerApplication_AfterNewPresentationEvent); // add a new presentation with one new slide PowerPoint.Presentation presentation = application.Presentations.Add(MsoTriState.msoTrue); PowerPoint.Slide slide = presentation.Slides.Add(1, PpSlideLayout.ppLayoutBlank); System.Threading.Thread.Sleep(2000); // close the document presentation.Close(); if (_afterNewPresentation && _presentationClose) { return(new TestResult(true, DateTime.Now.Subtract(startTime), "", null, "")); } else { return(new TestResult(false, DateTime.Now.Subtract(startTime), String.Format("AfterNewPresentation:{0} , PresentationClose:{1}", _afterNewPresentation, _presentationClose), null, "")); } } catch (Exception exception) { return(new TestResult(false, DateTime.Now.Subtract(startTime), exception.Message, exception, "")); } finally { if (null != application) { application.Quit(); application.Dispose(); } } }
public TestResult DoTest() { PowerPoint.Application application = null; DateTime startTime = DateTime.Now; try { application = COMObject.Create <PowerPoint.Application>(COMObjectCreateOptions.CreateNewCore); // add a new presentation with one new slide PowerPoint.Presentation presentation = application.Presentations.Add(MsoTriState.msoTrue); PowerPoint.Slide slide = presentation.Slides.Add(1, PpSlideLayout.ppLayoutBlank); // add a label PowerPoint.Shape label = slide.Shapes.AddLabel(MsoTextOrientation.msoTextOrientationHorizontal, 10, 10, 600, 20); label.TextFrame.TextRange.Text = "This slide and created Shapes are created by NetOffice example."; // add a line slide.Shapes.AddLine(10, 80, 700, 80); // add a wordart slide.Shapes.AddTextEffect(MsoPresetTextEffect.msoTextEffect9, "This a WordArt", "Arial", 20, MsoTriState.msoTrue, MsoTriState.msoFalse, 10, 150); // add a star slide.Shapes.AddShape(MsoAutoShapeType.msoShape24pointStar, 200, 200, 250, 250); return(new TestResult(true, DateTime.Now.Subtract(startTime), "", null, "")); } catch (Exception exception) { return(new TestResult(false, DateTime.Now.Subtract(startTime), exception.Message, exception, "")); } finally { if (null != application) { application.Quit(); application.Dispose(); } } }
private static void SetPhotosOnPage(PowerPoint.Slide slide, DownloadedItem item) { //проверяем, сколько фотографий пойдет на слайд int photoOnPage = item.Bitmaps.Count; if (photoOnPage == 0) //tckb 0, завершаем { return; } byte numOfPhoto = 1; foreach (var photo in item.Bitmaps) { if (InsertPhotoToPage(slide, photo, numOfPhoto, photoOnPage)) { numOfPhoto++; } } }
private static bool InsertPhotoToPage(PowerPoint.Slide slide, string path, byte photoNum, int photoOnPage) { if (!System.IO.File.Exists(path)) { return(false); } var resizeSettings = CreateResizerSettings(photoNum, photoOnPage); var newImageSize = ImageResizer.Resizer.CalculateNewSize(path, resizeSettings); var newImageLocation = CreateImageLocation(photoNum, photoOnPage); try { slide.Shapes.AddPicture(path, MsoTriState.msoFalse, MsoTriState.msoTrue, left: newImageLocation.X, top: newImageLocation.Y, width: newImageSize.Width, height: newImageSize.Height); return(true); } catch { return(false); } }
public TestResult DoTest() { PowerPoint.Application application = null; DateTime startTime = DateTime.Now; try { application = new PowerPoint.Application(); // add a new presentation with two new slides PowerPoint.Presentation presentation = application.Presentations.Add(MsoTriState.msoTrue); PowerPoint.Slide slide1 = presentation.Slides.Add(1, PpSlideLayout.ppLayoutBlank); PowerPoint.Slide slide2 = presentation.Slides.Add(1, PpSlideLayout.ppLayoutBlank); // add shapes slide1.Shapes.AddShape(MsoAutoShapeType.msoShape4pointStar, 100, 100, 200, 200); slide2.Shapes.AddShape(MsoAutoShapeType.msoShapeDoubleWave, 200, 200, 200, 200); // change blend animation slide1.SlideShowTransition.EntryEffect = PpEntryEffect.ppEffectCoverDown; slide1.SlideShowTransition.Speed = PpTransitionSpeed.ppTransitionSpeedFast; slide2.SlideShowTransition.EntryEffect = PpEntryEffect.ppEffectCoverLeftDown; slide2.SlideShowTransition.Speed = PpTransitionSpeed.ppTransitionSpeedFast; return(new TestResult(true, DateTime.Now.Subtract(startTime), "", null, "")); } catch (Exception exception) { return(new TestResult(false, DateTime.Now.Subtract(startTime), exception.Message, exception, "")); } finally { if (null != application) { application.Quit(); application.Dispose(); } } }
public void RunExample() { // start powerpoint PowerPoint.Application powerApplication = new PowerPoint.Application(); // create a utils instance, no need for but helpful to keep the lines of code low CommonUtils utils = new CommonUtils(powerApplication); // add a new presentation with one new slide PowerPoint.Presentation presentation = powerApplication.Presentations.Add(MsoTriState.msoTrue); PowerPoint.Slide slide = presentation.Slides.Add(1, PpSlideLayout.ppLayoutBlank); // add a label PowerPoint.Shape label = slide.Shapes.AddLabel(MsoTextOrientation.msoTextOrientationHorizontal, 10, 10, 600, 20); label.TextFrame.TextRange.Text = "This slide and created Shapes are created by NetOffice example."; // add a line slide.Shapes.AddLine(10, 80, 700, 80); // add a wordart slide.Shapes.AddTextEffect(MsoPresetTextEffect.msoTextEffect9, "This a WordArt", "Arial", 20, MsoTriState.msoTrue, MsoTriState.msoFalse, 10, 150); // add a star slide.Shapes.AddShape(MsoAutoShapeType.msoShape24pointStar, 200, 200, 250, 250); // save the document string documentFile = utils.File.Combine(HostApplication.RootDirectory, "Example02", DocumentFormat.Normal); presentation.SaveAs(documentFile); // close power point and dispose reference powerApplication.Quit(); powerApplication.Dispose(); // show end dialog HostApplication.ShowFinishDialog(null, documentFile); }
public void RunExample() { // start powerpoint PowerPoint.Application powerApplication = new PowerPoint.Application(); // add a new presentation with one new slide PowerPoint.Presentation presentation = powerApplication.Presentations.Add(MsoTriState.msoTrue); PowerPoint.Slide slide = presentation.Slides.Add(1, PpSlideLayout.ppLayoutBlank); // add a label PowerPoint.Shape label = slide.Shapes.AddLabel(MsoTextOrientation.msoTextOrientationHorizontal, 10, 10, 600, 20); label.TextFrame.TextRange.Text = "This slide and created Shapes are created by NetOffice example."; // add a line slide.Shapes.AddLine(10, 80, 700, 80); // add a wordart slide.Shapes.AddTextEffect(MsoPresetTextEffect.msoTextEffect9, "This a WordArt", "Arial", 20, MsoTriState.msoTrue, MsoTriState.msoFalse, 10, 150); // add a star slide.Shapes.AddShape(MsoAutoShapeType.msoShape24pointStar, 200, 200, 250, 250); // save the document string fileExtension = GetDefaultExtension(powerApplication); string documentFile = string.Format("{0}\\Example02{1}", _hostApplication.RootDirectory, fileExtension); presentation.SaveAs(documentFile); // close power point and dispose reference powerApplication.Quit(); powerApplication.Dispose(); // show dialog for the user(you!) _hostApplication.ShowFinishDialog(null, documentFile); }
public void RunExample() { // start powerpoint PowerPoint.Application powerApplication = new PowerPoint.Application(); // create a utils instance, no need for but helpful to keep the lines of code low CommonUtils utils = new CommonUtils(powerApplication); // add a new presentation with two new slides PowerPoint.Presentation presentation = powerApplication.Presentations.Add(MsoTriState.msoTrue); PowerPoint.Slide slide1 = presentation.Slides.Add(1, PpSlideLayout.ppLayoutBlank); PowerPoint.Slide slide2 = presentation.Slides.Add(1, PpSlideLayout.ppLayoutBlank); // add shapes slide1.Shapes.AddShape(MsoAutoShapeType.msoShape4pointStar, 100, 100, 200, 200); slide2.Shapes.AddShape(MsoAutoShapeType.msoShapeDoubleWave, 200, 200, 200, 200); // change blend animation slide1.SlideShowTransition.EntryEffect = PpEntryEffect.ppEffectCoverDown; slide1.SlideShowTransition.Speed = PpTransitionSpeed.ppTransitionSpeedFast; slide2.SlideShowTransition.EntryEffect = PpEntryEffect.ppEffectCoverLeftDown; slide2.SlideShowTransition.Speed = PpTransitionSpeed.ppTransitionSpeedFast; // save the document string documentFile = utils.File.Combine(HostApplication.RootDirectory, "Example04", DocumentFormat.Normal); presentation.SaveAs(documentFile); // close power point and dispose reference powerApplication.Quit(); powerApplication.Dispose(); // show end dialog HostApplication.ShowFinishDialog(null, documentFile); }
public TestResult DoTest() { PowerPoint.Application application = null; DateTime startTime = DateTime.Now; try { Bitmap iconBitmap = new Bitmap(System.Reflection.Assembly.GetAssembly(this.GetType()).GetManifestResourceStream("PowerPointTestsCSharp.Test06.bmp")); application = new PowerPoint.Application(); Office.CommandBar commandBar; Office.CommandBarButton commandBarBtn; // add a new presentation with one new slide PowerPoint.Presentation presentation = application.Presentations.Add(MsoTriState.msoTrue); PowerPoint.Slide slide = presentation.Slides.Add(1, PpSlideLayout.ppLayoutBlank); // add a commandbar popup Office.CommandBarPopup commandBarPopup = (Office.CommandBarPopup)application.CommandBars["Menu Bar"].Controls.Add(MsoControlType.msoControlPopup, System.Type.Missing, System.Type.Missing, System.Type.Missing, true); commandBarPopup.Caption = "commandBarPopup"; #region CommandBarButton // add a button to the popup commandBarBtn = (Office.CommandBarButton)commandBarPopup.Controls.Add(MsoControlType.msoControlButton, System.Type.Missing, System.Type.Missing, System.Type.Missing, true); commandBarBtn.Style = MsoButtonStyle.msoButtonIconAndCaption; commandBarBtn.Caption = "commandBarButton"; Clipboard.SetDataObject(iconBitmap); commandBarBtn.PasteFace(); commandBarBtn.ClickEvent += new Office.CommandBarButton_ClickEventHandler(commandBarBtn_Click); #endregion #region Create a new toolbar // add a new toolbar commandBar = application.CommandBars.Add("MyCommandBar", MsoBarPosition.msoBarTop, false, true); commandBar.Visible = true; // add a button to the toolbar commandBarBtn = (Office.CommandBarButton)commandBar.Controls.Add(MsoControlType.msoControlButton, System.Type.Missing, System.Type.Missing, System.Type.Missing, true); commandBarBtn.Style = MsoButtonStyle.msoButtonIconAndCaption; commandBarBtn.Caption = "commandBarButton"; commandBarBtn.FaceId = 3; commandBarBtn.ClickEvent += new Office.CommandBarButton_ClickEventHandler(commandBarBtn_Click); // add a dropdown box to the toolbar commandBarPopup = (Office.CommandBarPopup)commandBar.Controls.Add(MsoControlType.msoControlPopup, System.Type.Missing, System.Type.Missing, System.Type.Missing, true); commandBarPopup.Caption = "commandBarPopup"; // add a button to the popup, we use an own icon for the button commandBarBtn = (Office.CommandBarButton)commandBarPopup.Controls.Add(MsoControlType.msoControlButton, System.Type.Missing, System.Type.Missing, System.Type.Missing, true); commandBarBtn.Style = MsoButtonStyle.msoButtonIconAndCaption; commandBarBtn.Caption = "commandBarButton"; Clipboard.SetDataObject(iconBitmap); commandBarBtn.PasteFace(); commandBarBtn.ClickEvent += new Office.CommandBarButton_ClickEventHandler(commandBarBtn_Click); #endregion #region Create a new ContextMenu // add a commandbar popup commandBarPopup = (Office.CommandBarPopup)application.CommandBars["Frames"].Controls.Add( MsoControlType.msoControlPopup, Missing.Value, Missing.Value, Missing.Value, true); commandBarPopup.Caption = "commandBarPopup"; // add a button to the popup commandBarBtn = (Office.CommandBarButton)commandBarPopup.Controls.Add(MsoControlType.msoControlButton, Missing.Value, Missing.Value, Missing.Value, true); commandBarBtn.Style = MsoButtonStyle.msoButtonIconAndCaption; commandBarBtn.Caption = "commandBarButton"; commandBarBtn.FaceId = 9; commandBarBtn.ClickEvent += new Office.CommandBarButton_ClickEventHandler(commandBarBtn_Click); #endregion return(new TestResult(true, DateTime.Now.Subtract(startTime), "", null, "")); } catch (Exception exception) { return(new TestResult(false, DateTime.Now.Subtract(startTime), exception.Message, exception, "")); } finally { if (null != application) { application.Quit(); application.Dispose(); } } }
public Slide(PowerPoint.Presentation presentation, PowerPoint.Slide ppSlide, string slideIdTagName) { this.presentation = presentation; this.slide = ppSlide; this.slideIdTagName = slideIdTagName; }
public Slide(PowerPoint.Slide ppSlide, string slideIdTagName) { this.slide = ppSlide; this.slideIdTagName = slideIdTagName; }
public void NextSlide() { getPPtData(); slideIndex = slide.SlideIndex + 1; if (slideIndex > slidescount) { //MessageBox.Show("It is already last page") // rumble wiimote } else { try { slide = slides[slideIndex]; slides[slideIndex].Select(); } catch { pptApplication.SlideShowWindows[1].View.Next(); slide = pptApplication.SlideShowWindows[1].View.Slide; } } }
public Slide(PowerPoint.Slide slide) { this.slide = slide; this.tags = new PowerPointTags(this.slide); }
private void buttonStartExample_Click(object sender, EventArgs e) { // start powerpoint _powerApplication = new PowerPoint.Application(); Office.CommandBar commandBar = null; Office.CommandBarButton commandBarBtn = null; // add a new presentation with one new slide PowerPoint.Presentation presentation = _powerApplication.Presentations.Add(MsoTriState.msoTrue); PowerPoint.Slide slide = presentation.Slides.Add(1, PpSlideLayout.ppLayoutBlank); // add a commandbar popup Office.CommandBarPopup commandBarPopup = (Office.CommandBarPopup)_powerApplication.CommandBars["Menu Bar"].Controls.Add(MsoControlType.msoControlPopup, System.Type.Missing, System.Type.Missing, System.Type.Missing, true); commandBarPopup.Caption = "commandBarPopup"; #region few words, how to access the picture /* * you can see we use an own icon via .PasteFace() * is not possible from outside process boundaries to use the PictureProperty directly * the reason for is IPictureDisp: http://support.microsoft.com/kb/286460/de * its not important is early or late binding or managed or unmanaged, the behaviour is always the same * For example, a COMAddin running as InProcServer and can access the Picture Property */ #endregion #region CommandBarButton // add a button to the popup commandBarBtn = (Office.CommandBarButton)commandBarPopup.Controls.Add(MsoControlType.msoControlButton, System.Type.Missing, System.Type.Missing, System.Type.Missing, true); commandBarBtn.Style = MsoButtonStyle.msoButtonIconAndCaption; commandBarBtn.Caption = "commandBarButton"; Clipboard.SetDataObject(HostApplication.DisplayIcon.ToBitmap()); commandBarBtn.PasteFace(); commandBarBtn.ClickEvent += new Office.CommandBarButton_ClickEventHandler(commandBarBtn_Click); #endregion #region Create a new toolbar // add a new toolbar commandBar = _powerApplication.CommandBars.Add("MyCommandBar", MsoBarPosition.msoBarTop, false, true); commandBar.Visible = true; // add a button to the toolbar commandBarBtn = (Office.CommandBarButton)commandBar.Controls.Add(MsoControlType.msoControlButton, System.Type.Missing, System.Type.Missing, System.Type.Missing, true); commandBarBtn.Style = MsoButtonStyle.msoButtonIconAndCaption; commandBarBtn.Caption = "commandBarButton"; commandBarBtn.FaceId = 3; commandBarBtn.ClickEvent += new Office.CommandBarButton_ClickEventHandler(commandBarBtn_Click); // add a dropdown box to the toolbar commandBarPopup = (Office.CommandBarPopup)commandBar.Controls.Add(MsoControlType.msoControlPopup, System.Type.Missing, System.Type.Missing, System.Type.Missing, true); commandBarPopup.Caption = "commandBarPopup"; // add a button to the popup, we use an own icon for the button commandBarBtn = (Office.CommandBarButton)commandBarPopup.Controls.Add(MsoControlType.msoControlButton, System.Type.Missing, System.Type.Missing, System.Type.Missing, true); commandBarBtn.Style = MsoButtonStyle.msoButtonIconAndCaption; commandBarBtn.Caption = "commandBarButton"; Clipboard.SetDataObject(HostApplication.DisplayIcon.ToBitmap()); commandBarBtn.PasteFace(); commandBarBtn.ClickEvent += new Office.CommandBarButton_ClickEventHandler(commandBarBtn_Click); #endregion #region Create a new ContextMenu // add a commandbar popup commandBarPopup = (Office.CommandBarPopup)_powerApplication.CommandBars["Frames"].Controls.Add( MsoControlType.msoControlPopup, Missing.Value, Missing.Value, Missing.Value, true); commandBarPopup.Caption = "commandBarPopup"; // add a button to the popup commandBarBtn = (Office.CommandBarButton)commandBarPopup.Controls.Add(MsoControlType.msoControlButton, Missing.Value, Missing.Value, Missing.Value, true); commandBarBtn.Style = MsoButtonStyle.msoButtonIconAndCaption; commandBarBtn.Caption = "commandBarButton"; commandBarBtn.FaceId = 9; commandBarBtn.ClickEvent += new Office.CommandBarButton_ClickEventHandler(commandBarBtn_Click); #endregion // make visible & set buttons _powerApplication.Visible = MsoTriState.msoTrue; buttonStartExample.Enabled = false; buttonQuitExample.Enabled = true; }
public void PrevSlide() { getPPtData(); slideIndex = slide.SlideIndex - 1; if (slideIndex >= 1) { try { slide = slides[slideIndex]; slides[slideIndex].Select(); } catch { pptApplication.SlideShowWindows[1].View.Previous(); slide = pptApplication.SlideShowWindows[1].View.Slide; } } else { //MessageBox.Show("It is already Fist Page"); } }
public PowerPointTags(PowerPoint.Slide slide) { this.element = slide; }
// Transform to Last Page public void gotoLast() { getPPtData(); try { slides[slidescount].Select(); slide = slides[slidescount]; } catch { pptApplication.SlideShowWindows[1].View.Last(); slide = pptApplication.SlideShowWindows[1].View.Slide; } }
private void getPPtData() { try { if (pptApplication != null) { // Get Presentation Object presentation = pptApplication.ActivePresentation; // Get Slide collection object slides = presentation.Slides; // Get Slide count slidescount = slides.Count; // Get current selected slide try { // Get selected slide object in normal view slide = slides[pptApplication.ActiveWindow.Selection.SlideRange.SlideNumber]; } catch { // Get selected slide object in reading view slide = pptApplication.SlideShowWindows[1].View.Slide; } } } catch { // if pptApplication.SlideShowWindows[1].View.Slide is invalid, // e.g. the 'Press any key to exit slideshow' screen // ignore. } }
private void SetNotes(PowerPoint.Slide slide, string text) { throw new NotImplementedException(); }
// Transform to First Page public void gotoFirst() { getPPtData(); try { // Call Select method to select first slide in normal view slides[1].Select(); slide = slides[1]; } catch { // Transform to first page in reading view pptApplication.SlideShowWindows[1].View.First(); slide = pptApplication.SlideShowWindows[1].View.Slide; } }
public void SetImage(NetOffice.PowerPointApi.Slide slide) { InvokerService.InvokeInternal.ExecuteMethod(this, "SetImage", slide); }