How to remove speaker notes from a presentation slide in C#

We have demonstrated how to use Spire.Presentation to add and get speaker notes in presentation slides. This article will show how to remove the speaker notes in presentation slides in C#.

Firstly, view the sample document contains the speaker notes.

How to remove speaker notes from a presentation slide in C#

Step 1: Create a presentation document and load the document from the file.

Presentation ppt = new Presentation();
ppt.LoadFromFile("Sample.pptx", FileFormat.Pptx2013);

Step 2: Get the first slide from the sample document.

ISlide slide = ppt.Slides[0];

Step 3: Remove the first speak notes:

slide.NotesSlide.NotesTextFrame.Paragraphs.RemoveAt(1);

Remove all the speak notes from the first slide:

slide.NotesSlide.NotesTextFrame.Paragraphs.Clear();

Step 4: Save the document to file.

ppt.SaveToFile("Result.pptx",FileFormat.Pptx2013);

Effective screenshot of removing the first note:

How to remove speaker notes from a presentation slide in C#

Effective screenshot of removing all the notes:

How to remove speaker notes from a presentation slide in C#

Full codes:

Remove the first note in presentation slide:

Presentation ppt = new Presentation();
ppt.LoadFromFile("Sample.pptx", FileFormat.Pptx2013);

ISlide slide = ppt.Slides[0];
           
slide.NotesSlide.NotesTextFrame.Paragraphs.RemoveAt(1);
ppt.SaveToFile("Result.pptx",FileFormat.Pptx2013);

Clear all notes in presentation slide:

Presentation ppt = new Presentation();
ppt.LoadFromFile("Sample.pptx", FileFormat.Pptx2013);

ISlide slide = ppt.Slides[0];
           
slide.NotesSlide.NotesTextFrame.Paragraphs.Clear();
ppt.SaveToFile("Result2.pptx",FileFormat.Pptx2013);