Compartir a través de


Working with Notes Slides

Applies to: Excel 2010 | Office 2010 | PowerPoint 2010 | Word 2010

In this article
Notes Slides in PresentationML
Open XML SDK 2.0 NotesSlide Class
Working with the NotesSlide Class
Open XML SDK Code Example
Generated PresentationML

This topic discusses the Open XML SDK 2.0 NotesSlide class and how it relates to the Open XML File Format PresentationML schema.

Notes Slides in PresentationML

The ISO/IEC 29500 specification describes the Open XML PresentationML <notes> element used to represent notes slides in a PresentationML document as follows:

This element specifies the existence of a notes slide along with its corresponding data. Contained within a notes slide are all the common slide elements along with additional properties that are specific to the notes element.

[Example: Consider the following PresentationML notes slide:

<p:notes>
    <p:cSld>
        …
    </p:cSld>
    …
</p:notes>

In the above example a notes element specifies the existence of a notes slide with all of its parts. Notice the cSld element, which specifies the common elements that can appear on any slide type and then any elements specify additional non-common properties for this notes slide. end example]

© ISO/IEC29500: 2008.

The <notes> element is the root element of the PresentationML Notes Slide part. For more information about the overall structure of the parts and elements that make up a PresentationML document, see Structure of a PresentationML Document.

The following table lists the child elements of the <notes> element used when working with notes slides and the Open XML SDK 2.0 classes that correspond to them.

PresentationML Element

Open XML SDK 2.0 Class

<clrMapOvr>

ColorMapOverride

<cSld>

CommonSlideData

<extLst>

ExtensionListWithModification

The following table from the ISO/IEC 29500 specification describes the attributes of the <notes> element.

Attributes

Description

showMasterPhAnim (Show Master Placeholder Animations)

Specifies whether or not to display animations on placeholders from the master slide.

The possible values for this attribute are defined by the W3C XML Schema boolean datatype.

showMasterSp (Show Master Shapes)

Specifies if shapes on the master slide should be shown on slides or not.

The possible values for this attribute are defined by the W3C XML Schema boolean datatype.

© ISO/IEC29500: 2008.

Open XML SDK 2.0 NotesSlide Class

The OXML SDK NotesSlide class represents the <notes> element defined in the Open XML File Format schema for PresentationML documents. Use the NotesSlide class to manipulate individual <notes> elements in a PresentationML document.

Classes that represent child elements of the <notes> element and that are therefore commonly associated with the NotesSlide class are shown in the following list.

ColorMapOverride Class

The ColorMapOverride class corresponds to the <clrMapOvr> element. The following information from the ISO/IEC 29500 specification introduces the <clrMapOvr> element:

This element provides a mechanism with which to override the color schemes listed within the <ClrMap> element. If the <masterClrMapping> child element is present, the color scheme defined by the master is used. If the <overrideClrMapping> child element is present, it defines a new color scheme specific to the parent notes slide, presentation slide, or slide layout.

© ISO/IEC29500: 2008.

CommonSlideData Class

The CommonSlideData class corresponds to the <cSld> element. The following information from the ISO/IEC 29500 specification introduces the <cSld> element:

This element specifies a container for the type of slide information that is relevant to all of the slide types. All slides share a common set of properties that is independent of the slide type; the description of these properties for any particular slide is stored within the slide's <cSld> container. Slide data specific to the slide type indicated by the parent element is stored elsewhere.

The actual data in <cSld> describe only the particular parent slide; it is only the type of information stored that is common across all slides.

© ISO/IEC29500: 2008.

ExtensionListWithModification Class

The ExtensionListWithModification class corresponds to the <extLst>element. The following information from the ISO/IEC 29500 specification introduces the <extLst> element:

This element specifies the extension list with modification ability within which all future extensions of element type <ext> are defined. The extension list along with corresponding future extensions is used to extend the storage capabilities of the PresentationML framework. This allows for various new kinds of data to be stored natively within the framework.

[Note: Using this extLst element allows the generating application to store whether this extension property has been modified. end note]

© ISO/IEC29500: 2008.

Working with the NotesSlide Class

As shown in the Open XML SDK code sample that follows, every instance of the NotesSlide class is associated with an instance of the NotesSlidePart class, which represents a notes slide part, one of the parts of a PresentationML presentation file package, and a part that is required for each notes slide in a presentation file. Each NotesSlide class instance may also be associated with an instance of the NotesMaster class, which in turn is associated with a similarly named presentation part, represented by the NotesMasterPart class.

The NotesSlide class, which represents the <notes> element, is therefore also associated with a series of other classes that represent the child elements of the <notes> element. Among these classes, as shown in the following code sample, are the CommonSlideData class and the ColorMapOverride class. The ShapeTree class and the Shape classes are in turn associated with the CommonSlideData class.

Open XML SDK Code Example

The following method adds a new notes slide part to an existing presentation and creates an instance of an Open XML SDK 2.0 NotesSlide class in the new notes slide part. The NotesSlide class constructor creates instances of the CommonSlideData class and the ColorMap class. The CommonSlideData class constructor creates an instance of the ShapeTree class, whose constructor in turn creates additional class instances: an instance of the NonVisualGroupShapeProperties class, an instance of the GroupShapeProperties class, and an instance of the Shape class.

The namespace represented by the letter P in the code is the DocumentFormat.OpenXml.Presentation namespace.

private static NotesSlidePart CreateNotesSlidePart(SlidePart slidePart1)
    {
        NotesSlidePart notesSlidePart1 = slidePart1.AddNewPart<NotesSlidePart>("rId6");
        NotesSlide notesSlide = new NotesSlide(
        new CommonSlideData(new ShapeTree(
          new P.NonVisualGroupShapeProperties(
          new P.NonVisualDrawingProperties() { Id = (UInt32Value)1U, Name = "" },
          new P.NonVisualGroupShapeDrawingProperties(),
          new ApplicationNonVisualDrawingProperties()),
          new GroupShapeProperties(new TransformGroup()),
          new P.Shape(
          new P.NonVisualShapeProperties(
            new P.NonVisualDrawingProperties() { Id = (UInt32Value)2U, Name = "" },
            new P.NonVisualShapeDrawingProperties(new ShapeLocks() { NoGrouping = true }),
            new ApplicationNonVisualDrawingProperties(new PlaceholderShape())),
          new P.ShapeProperties(),
          new P.TextBody(
            new BodyProperties(),
            new ListStyle(),
            new Paragraph(new EndParagraphRunProperties()))))),
        new ColorMapOverride(new MasterColorMapping()));
        notesSlidePart1.NotesSlide = notesSlide;
        return notesSlidePart1;
    }
Private Shared Function CreateNotesSlidePart(ByVal slidePart1 As SlidePart) As NotesSlidePart
        Dim notesSlidePart1 As NotesSlidePart = slidePart1.AddNewPart(Of NotesSlidePart)("rId6")
        Dim notesSlide As New NotesSlide(New CommonSlideData(New ShapeTree(New P.NonVisualGroupShapeProperties(New P.NonVisualDrawingProperties() With { _
         .Id = DirectCast(1UI, UInt32Value), _
         .Name = "" _
        }, New P.NonVisualGroupShapeDrawingProperties(), New ApplicationNonVisualDrawingProperties()), New  _
            GroupShapeProperties(New TransformGroup()), New P.Shape(New P.NonVisualShapeProperties(New P.NonVisualDrawingProperties() With { _
         .Id = DirectCast(2UI, UInt32Value), _
         .Name = "" _
        }, New P.NonVisualShapeDrawingProperties(New ShapeLocks() With { _
         .NoGrouping = True _
        }), New ApplicationNonVisualDrawingProperties(New PlaceholderShape())), New P.ShapeProperties(), New  _
            P.TextBody(New BodyProperties(), New ListStyle(), New Paragraph(New EndParagraphRunProperties()))))),
        New ColorMapOverride(New MasterColorMapping()))
        notesSlidePart1.NotesSlide = notesSlide
        Return notesSlidePart1
    End Function

Generated PresentationML

When the Open XML SDK 2.0 code is run, the following XML is written to the PresentationML document referenced in the code.

<?xml version="1.0" encoding="utf-8"?>
<p:notes xmlns:p="https://schemas.openxmlformats.org/presentationml/2006/main">
  <p:cSld>
    <p:spTree>
      <p:nvGrpSpPr>
        <p:cNvPr id="1"
                 name="" />
        <p:cNvGrpSpPr />
        <p:nvPr />
      </p:nvGrpSpPr>
      <p:grpSpPr>
        <a:xfrm xmlns:a="https://schemas.openxmlformats.org/drawingml/2006/main" />
      </p:grpSpPr>
      <p:sp>
        <p:nvSpPr>
          <p:cNvPr id="2"
                   name="" />
          <p:cNvSpPr>
            <a:spLocks noGrp="1"
                       xmlns:a="https://schemas.openxmlformats.org/drawingml/2006/main" />
          </p:cNvSpPr>
          <p:nvPr>
            <p:ph />
          </p:nvPr>
        </p:nvSpPr>
        <p:spPr />
        <p:txBody>
          <a:bodyPr xmlns:a="https://schemas.openxmlformats.org/drawingml/2006/main" />
          <a:lstStyle xmlns:a="https://schemas.openxmlformats.org/drawingml/2006/main" />
          <a:p xmlns:a="https://schemas.openxmlformats.org/drawingml/2006/main">
            <a:endParaRPr />
          </a:p>
        </p:txBody>
      </p:sp>
    </p:spTree>
  </p:cSld>
  <p:clrMapOvr>
    <a:masterClrMapping xmlns:a="https://schemas.openxmlformats.org/drawingml/2006/main" />
  </p:clrMapOvr>
</p:notes>

See Also

Concepts

About the Open XML SDK 2.0 for Microsoft Office

How to: Create a Presentation by Providing a File Name

How to: Insert a New Slide into a Presentation

How to: Delete a Slide from a Presentation

How to: Apply a Theme to a Presentation