PowerPoint Deck Generator Sample

Note

This sample runs only in Microsoft Office Word 2007.

This sample is a Word template that enables you to create a first draft of a Microsoft Office PowerPoint 2007 presentation from a Word document, without having to copy and paste information from your Word outline into PowerPoint. The PowerPoint presentation is generated from the Word document, based on XML tags that you add to text in the document.

To make this sample template accessible from the Word template dialog box, put the sample template in a standard templates folder such as %UserProfile%\Application Data\Microsoft\Templates (Windows XP or Windows Server 2003) or %UserProfile%\AppData\Roaming\Microsoft\Templates (Windows Vista).

Security noteSecurity Note:

This sample code is intended to illustrate a concept, and it shows only the code that is relevant to that concept. It may not meet the security requirements for a specific environment, and it should not be used exactly as shown. We recommend that you add security and error-handling code to make your projects more secure and robust. Microsoft provides this sample code "AS IS" with no warranties.

To run this sample

  1. Press F5.

    An empty Word document opens, created from the sample template.

  2. Add information to the Word document to create the PowerPoint presentation. Include a title for each slide, normal text, bulleted lists, and notes for the presenter that do not appear on the slides.

  3. If the Document Actions task pane is not visible, on the View menu, click Task Pane, and then click Document Actions in the drop-down list of task panes at the top of the new pane.

  4. Select text in the document that you want to appear in the PowerPoint presentation, and then click the XML tag in the Document markup list that you want to apply to the text. Consider the following details:

    • To start a new slide, apply the Slide Title element to some text. Each slide must start with a title, and you must start the presentation with a title.

    • Non-text elements such as images, shapes, and tables are not added to the PowerPoint presentation.

    • XML elements cannot overlap.

    • You can place the insertion point in the document without selecting text and click an XML tag in the task pane. This adds an empty XML tag to the document at the indicated position, and you can enter new content in that XML tag.

    • You can navigate to a slide title in the document by clicking that slide in the Preview window. You can also navigate to a slide by clicking inside an XML tag in the document.

  5. When you have finished marking up the document, click Create Presentation.

  6. Name and save the presentation.

  7. On the File menu, click Save and save the Word document in the build output folder that contains the solution assembly (for example, \bin\debug).

    If you want to save the document in a different location, you must also copy the solution assembly to the same folder. The document uses a relative path to locate the assembly, so they must be stored in the same location. After you move the assembly, you must grant it full trust in your security policy. For more information, see How to: Deploy Solution Files Manually (2003 System) and How to: Grant Permissions to Folders and Assemblies (2003 System).

Requirements

For full functionality, this sample requires the following components:

Demonstrates

This sample demonstrates:

  • How to add custom controls to the Document Actions task pane and interact with them.

  • How to automate PowerPoint from within Word.

  • How to add XML to a Word document.

The following is the list of XML tags that can be applied to content in the Word document:

  • SlideTitle. Indicates the start of a new PowerPoint slide.

  • Bullet. Indicates text on a PowerPoint slide that will be bulleted.

  • Text. Indicates text on a PowerPoint slide that will not be bulleted.

  • Note. Indicates content that will be added to the Notes section of a slide.

Remarks

You cannot programmatically add an XMLNode around a selection that includes multiple paragraphs, if the selection begins in the middle of a paragraph and includes a paragraph break.

If you select an area that starts at the beginning of a paragraph, spans more than one paragraph, and ends in the middle of a paragraph, you will see unexpected behavior. When you insert a node, the node begins at the correct point but ends at the end of the last paragraph prior to the end of your selection, instead of at the end of your selection.

See Also

Concepts

XML Schemas and Data (Visual Studio Tools for Office)

Programming Document-Level Customizations

Word Document-Level Customization Development

Other Resources

Document-Level Samples