0

これが私が取り組んできたコードです。スライドにメモを含むメッセージ ボックスを表示する必要があると思いますが、表示されません。また、一部のコードを使用して音声合成を実装する方法がわかりませんが、間違った場所にある可能性があります。

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Linq;
using PowerPoint = Microsoft.Office.Interop.PowerPoint;
using Office = Microsoft.Office.Core;
using Microsoft.Office.Interop.PowerPoint;
using System.Speech.Synthesis;


namespace FirstPowerPointAddIn
{
public partial class ThisAddIn
{
private void ThisAddIn_Startup(object sender, System.EventArgs e) 
{


         SpeechSynthesizer synth = new SpeechSynthesizer();
        // Configure the audio output. 
        synth.SetOutputToDefaultAudioDevice();

     PowerPoint.Application oPowerPoint = null;
     try
      {
            oPowerPoint.SlideShowBegin += oPowerPoint_SlideShowBegin;



            oPowerPoint.SlideShowNextSlide += oPowerPoint_SlideShowNextSlide;

       }
        catch(Exception)
        {
            Console.WriteLine("error");
        }
    }



    private void ThisAddIn_Shutdown(object Pender, System.EventArgs e)
    {
    }



    private void oPowerPoint_SlideShowBegin(SlideShowWindow Wn) 

     // If the slide has notes, get the notes
    {
        if (Wn.View.Slide.HasNotesPage == Microsoft.Office.Core.MsoTriState.msoTrue)
        {

            if (Wn.View.Slide.NotesPage.Shapes[2].TextFrame.HasText == Microsoft.Office.Core.MsoTriState.msoTrue)

                System.Windows.Forms.MessageBox.Show(Wn.View.Slide.NotesPage.Shapes[2].TextFrame.TextRange.Text);



        }
    }
    void oPowerPoint_SlideShowNextSlide(PowerPoint.SlideShowWindow Wn)
    {

        if (Wn.View.Slide.HasNotesPage == Microsoft.Office.Core.MsoTriState.msoTrue)
        {

            if (Wn.View.Slide.NotesPage.Shapes[2].TextFrame.HasText == Microsoft.Office.Core.MsoTriState.msoTrue)

                System.Windows.Forms.MessageBox.Show(Wn.View.Slide.NotesPage.Shapes[2].TextFrame.TextRange.Text);



        }
    }

    #region VSTO generated code

    /// <summary>
    /// Required method for Designer support - do not modify
    /// the contents of this method with the code editor.
    /// </summary>
    private void InternalStartup()
    {
        this.Startup += new System.EventHandler(ThisAddIn_Startup);
        this.Shutdown += new System.EventHandler(ThisAddIn_Shutdown);
    }

    #endregion
}

}

4

2 に答える 2