Add, Read, or Delete PowerPoint Speaker Notes with JavaScript in React

Speaker notes are the script that lives outside the slides: talking points, timing reminders, and ad-lib lines the audience never sees during a show. When you organize courseware, reuse templates, or export meeting notes as text, you often need to write, pull out, or clear these notes in bulk. Doing it page by page in a desktop app gets slow once a deck grows, and uploading files to a server takes the content off the user's machine.

This article uses Spire.Presentation for JavaScript to add, read, and delete speaker notes in the browser. The whole process runs on WebAssembly and reads and writes pptx through a virtual file system (VFS), so it needs no Office install and no backend.

The article covers three core features:

For installation and project setup, see Integrate Spire.Presentation for JavaScript in a React project. The examples below assume Spire.Presentation is installed and the WebAssembly module is initialized.


Add Speaker Notes to a PowerPoint Slide

Spire.Presentation for JavaScript provides the AddNotesSlide() method to create a notes slide for a given slide, then writes the note text through NotesTextFrame.Text.

Approach What gets written
NotesTextFrame.Text = '...' One block of text covering the whole notes slide
NotesTextFrame.Paragraphs.AppendoTextParagraph(p) Appends one paragraph, which can have its own bullet

Steps:

  1. Get the Spire.Presentation WASM module and make sure it is ready.
  2. Load the sample presentation and create a Presentation object.
  3. Use Slides.get_Item() to get the target slide, call AddNotesSlide() to create a notes slide, then write NotesTextFrame.Text.
  4. Save the result with Presentation.SaveToFile().
  5. Read the result file from the VFS and trigger a browser download.

Code:

function App() {
  const addSpeakerNotes = async () => {
    // Get the Spire.Presentation WASM module
    const pptModule = window.wasmModule?.spirepresentation;

    // Make sure the module is ready
    if (!pptModule) {
      alert('Spire.Presentation is not ready yet');
      return;
    }

    // Load the sample presentation
    await window.spire.FetchFileToVFS('SamplePresentation.pptx', "", `${process.env.PUBLIC_URL}/data/`);

    // Create a Presentation instance and load the file
    const ppt = new pptModule.Presentation();
    ppt.LoadFromFile('SamplePresentation.pptx');

    // Get the second slide, which has no notes slide yet
    const slide = ppt.Slides.get_Item(1);

    // Create a notes slide, then write the note text
    const notesSlide = slide.AddNotesSlide();
    notesSlide.NotesTextFrame.Text = 'Start with a full product overview, then walk through the features page by page. Slow down when you reach data security and leave room for questions.';

    // Save the result file
    const outputFileName = 'PresentationWithSpeakerNotes.pptx';
    ppt.SaveToFile({ file: outputFileName, fileFormat: pptModule.FileFormat.Pptx2013 });
    ppt.Dispose();

    // Read the generated file from the VFS and trigger a download
    const fileArray = window.dotnetRuntime.Module.FS.readFile(outputFileName);
    const blob = new Blob([fileArray], { type: 'application/vnd.openxmlformats-officedocument.presentationml.presentation' });
    const url = URL.createObjectURL(blob);
    const a = document.createElement('a');
    a.href = url;
    a.download = outputFileName;
    a.click();
    URL.revokeObjectURL(url);
  };

  return (
    <div style={{ textAlign: 'center', height: '300px' }}>
      <h1>Add Speaker Notes</h1>
      <button onClick={addSpeakerNotes}>
        Add Speaker Notes
      </button>
    </div>
  );
}

export default App;

The note appears on the notes slide of the second slide:

Presentation after adding speaker notes

Write Notes in Paragraphs with Numbered Bullets

For a step-by-step checklist, append paragraphs one by one with Paragraphs.AppendoTextParagraph(), then turn each into a numbered list:

// Create a notes slide, then append paragraphs with their own numbering
const notesSlide = ppt.Slides.get_Item(1).AddNotesSlide();
const frame = notesSlide.NotesTextFrame;

const first = new pptModule.TextParagraph();
first.Text = 'Prepare the script';
frame.Paragraphs.AppendoTextParagraph(first);
frame.Paragraphs.get_Item(1).BulletType = pptModule.TextBulletType.Numbered;
frame.Paragraphs.get_Item(1).BulletStyle = pptModule.NumberedBulletStyle.BulletArabicPeriod;

const second = new pptModule.TextParagraph();
second.Text = 'Keep one core message per slide and trim the word count';
frame.Paragraphs.AppendoTextParagraph(second);
frame.Paragraphs.get_Item(2).BulletType = pptModule.TextBulletType.Numbered;
frame.Paragraphs.get_Item(2).BulletStyle = pptModule.NumberedBulletStyle.BulletArabicPeriod;

Read Speaker Notes from a PowerPoint File

Spire.Presentation for JavaScript also gets the notes slide via slide.NotesSlide, then reads the full note text through NotesTextFrame.Text.

Steps:

  1. Get the Spire.Presentation WASM module and make sure it is ready.
  2. Load the sample presentation and create a Presentation object.
  3. Use Slides.get_Item() to get the target slide, then read the note text through NotesSlide.NotesTextFrame.Text.
  4. Write the result into a txt file.
  5. Read the result file from the VFS and trigger a browser download.

Code:

function App() {
  const readSpeakerNotes = async () => {
    // Get the Spire.Presentation WASM module
    const pptModule = window.wasmModule?.spirepresentation;

    // Make sure the module is ready
    if (!pptModule) {
      alert('Spire.Presentation is not ready yet');
      return;
    }

    // Load the sample presentation
    await window.spire.FetchFileToVFS('SamplePresentation.pptx', "", `${process.env.PUBLIC_URL}/data/`);

    // Create a Presentation instance and load the file
    const ppt = new pptModule.Presentation();
    ppt.LoadFromFile('SamplePresentation.pptx');

    // Get the notes slide of the first slide and read all note text
    const slide = ppt.Slides.get_Item(0);
    const notesText = slide.NotesSlide.NotesTextFrame.Text;

    // Write the notes into a txt file
    const outputFileName = 'SpeakerNotes.txt';
    const content = `Speaker notes on slide 1:\n${notesText}`;
    window.dotnetRuntime.Module.FS.writeFile(outputFileName, content);
    ppt.Dispose();

    // Read the generated file from the VFS and trigger a download
    const fileArray = window.dotnetRuntime.Module.FS.readFile(outputFileName);
    const blob = new Blob([fileArray], { type: 'text/plain' });
    const url = URL.createObjectURL(blob);
    const a = document.createElement('a');
    a.href = url;
    a.download = outputFileName;
    a.click();
    URL.revokeObjectURL(url);
  };

  return (
    <div style={{ textAlign: 'center', height: '300px' }}>
      <h1>Read Speaker Notes</h1>
      <button onClick={readSpeakerNotes}>
        Read Speaker Notes
      </button>
    </div>
  );
}

export default App;

The exported txt file holds the full notes of the first slide:

Exported speaker notes text file


Delete Speaker Notes from a PowerPoint File

Spire.Presentation for JavaScript can clear the whole notes slide by assigning an empty string to NotesTextFrame.Text, or delete one paragraph by index with Paragraphs.RemoveAt().

Approach Effect
NotesTextFrame.Text = '' Clears all text on the notes slide; the notes slide stays but is empty
NotesTextFrame.Paragraphs.RemoveAt(index) Deletes only the paragraph at the given index; the rest stay

Steps:

  1. Get the Spire.Presentation WASM module and make sure it is ready.
  2. Load the sample presentation and create a Presentation object.
  3. Use Slides.get_Item() to get the target slide, then assign an empty string to NotesSlide.NotesTextFrame.Text.
  4. Save the result with Presentation.SaveToFile().
  5. Read the result file from the VFS and trigger a browser download.

Code:

function App() {
  const removeSpeakerNotes = async () => {
    // Get the Spire.Presentation WASM module
    const pptModule = window.wasmModule?.spirepresentation;

    // Make sure the module is ready
    if (!pptModule) {
      alert('Spire.Presentation is not ready yet');
      return;
    }

    // Load the sample presentation
    await window.spire.FetchFileToVFS('SamplePresentation.pptx', "", `${process.env.PUBLIC_URL}/data/`);

    // Create a Presentation instance and load the file
    const ppt = new pptModule.Presentation();
    ppt.LoadFromFile('SamplePresentation.pptx');

    // Get the notes slide of the first slide and clear the note text
    const slide = ppt.Slides.get_Item(0);
    slide.NotesSlide.NotesTextFrame.Text = '';

    // Save the result file
    const outputFileName = 'PresentationWithoutSpeakerNotes.pptx';
    ppt.SaveToFile({ file: outputFileName, fileFormat: pptModule.FileFormat.Pptx2013 });
    ppt.Dispose();

    // Read the generated file from the VFS and trigger a download
    const fileArray = window.dotnetRuntime.Module.FS.readFile(outputFileName);
    const blob = new Blob([fileArray], { type: 'application/vnd.openxmlformats-officedocument.presentationml.presentation' });
    const url = URL.createObjectURL(blob);
    const a = document.createElement('a');
    a.href = url;
    a.download = outputFileName;
    a.click();
    URL.revokeObjectURL(url);
  };

  return (
    <div style={{ textAlign: 'center', height: '300px' }}>
      <h1>Delete Speaker Notes</h1>
      <button onClick={removeSpeakerNotes}>
        Delete Speaker Notes
      </button>
    </div>
  );
}

export default App;

After clearing, the notes slide of the first slide holds no text:

Presentation after deleting speaker notes

Delete a Specific Notes Paragraph

To drop just one paragraph and keep the rest, use Paragraphs.RemoveAt() with an index:

// Delete only the given paragraph of the first slide's notes and keep the rest
const frame = ppt.Slides.get_Item(0).NotesSlide.NotesTextFrame;
frame.Paragraphs.RemoveAt(1);

FAQ

Do speaker notes show up during the slideshow

Cause: Speaker notes live on a separate notes slide. They are the presenter's script and are stored apart from the slide content.

Fix: The audience only sees the slide content during a show. Notes appear in Presenter View or the editing window, so read the notes slide when you need to adjust the talking points.

Can I read or delete notes on a slide that never had any

Cause: A slide with no notes slide has no note text to read, and clearing it does nothing.

Fix: Call AddNotesSlide() to create a notes slide and write content first, then read and write through NotesSlide.NotesTextFrame. In batch jobs, check whether a slide already has a notes slide before operating on it.

Should I clear the whole page or delete paragraph by paragraph

Cause: NotesTextFrame.Text addresses the whole notes slide, while Paragraphs addresses individual paragraphs.

Fix: To clear everything, assign an empty string with Text = ''. To remove just one paragraph, use Paragraphs.RemoveAt(index).

Do notes support Chinese and bullets

Cause: The notes text frame stores text as Unicode, and each paragraph can have its own bullet type and style.

Fix: Write the string directly, including Chinese. For an ordered list, set BulletType = TextBulletType.Numbered and BulletStyle = NumberedBulletStyle.BulletArabicPeriod on the paragraph.

How do Text and Paragraphs relate

Cause: NotesTextFrame.Text treats the whole notes slide as one block of text, while Paragraphs manages it paragraph by paragraph.

Fix: Use Text to overwrite or read the whole page, and Paragraphs to append paragraphs or delete them by index.


Get a Free License

If you want to remove the evaluation message from the result document or lift the feature limits, contact sales for a temporary license valid for 30 days.