Hi.

I have problem with this msdn article:
http://msdn.microsoft.com/en-us/library/gg278317.aspx

The aspx page not print error and the powerpoint presentation it's create in the disk c:\

But PowerPoint will not open my presentation generate with .net.

I try with Office 2003 licensed, this is my code... I don't see errors but Powerpoint not open pptx file because is damaged, missing part...

Can you help me?

Code:
<%@ Page Title="Home page" Language="C#" AutoEventWireup="true" %>

<%@ Import Namespace="System" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.Odbc" %>
<%@ Import Namespace="System.Drawing" %>
<%@ Import Namespace="System.IO" %>
<%@ Import Namespace="System.Collections.Generic" %>
<%@ Import Namespace="System.Linq" %>
<%@ Import Namespace="System.Configuration" %>
<%@ Import Namespace="System.Security.Principal" %>
<%@ Import Namespace="System.Text" %>
<%@ Import Namespace="DocumentFormat.OpenXml" %>
<%@ Import Namespace="DocumentFormat.OpenXml.Presentation" %>
<%@ Import Namespace="DocumentFormat.OpenXml.Packaging" %>
<%@ Import Namespace="DocumentFormat.OpenXml.Drawing" %>

....

<script runat="server">    
    

       
    private void Page_Load(object sender, System.EventArgs e)
    {

            string FilePPT = @"C:\\myTest.pptx";
        
            CreatePresentation(FilePPT);
      
            
                  
    }

    public static void CreatePresentation(string FilePPTDaSalvare)
       {
            PresentationDocument presentationDoc = PresentationDocument
                .Create(FilePPTDaSalvare, PresentationDocumentType.Presentation);
            PresentationPart presentationPart = presentationDoc
               .AddPresentationPart();
            
            presentationPart.Presentation = new Presentation();
            CreatePresentationParts(presentationPart);

            presentationDoc.Close();

        }


    private static void CreatePresentationParts(PresentationPart presentationPart)
    {
        SlideMasterIdList slideMasterIdList1 = new SlideMasterIdList(new SlideMasterId() { Id = (UInt32Value)2147483648U, RelationshipId = "rId1" });
        SlideIdList slideIdList1 = new SlideIdList(new SlideId() { Id = (UInt32Value)256U, RelationshipId = "rId2" });
        SlideSize slideSize1 = new SlideSize() { Cx = 9144000, Cy = 6858000, Type = SlideSizeValues.Screen4x3 };
        NotesSize notesSize1 = new NotesSize() { Cx = 6858000, Cy = 9144000 };
        DefaultTextStyle defaultTextStyle1 = new DefaultTextStyle();

        presentationPart.Presentation.Append(slideMasterIdList1, slideIdList1, slideSize1, notesSize1, defaultTextStyle1);

        SlidePart slidePart1;
        SlideLayoutPart slideLayoutPart1;
        SlideMasterPart slideMasterPart1;
        ThemePart themePart1;


        slidePart1 = CreateSlidePart(presentationPart);
        slideLayoutPart1 = CreateSlideLayoutPart(slidePart1);
        slideMasterPart1 = CreateSlideMasterPart(slideLayoutPart1);
        themePart1 = CreateTheme(slideMasterPart1);

        slideMasterPart1.AddPart(slideLayoutPart1, "rId1");
        presentationPart.AddPart(slideMasterPart1, "rId1");
        presentationPart.AddPart(themePart1, "rId5");
    }


    private static SlidePart CreateSlidePart(PresentationPart presentationPart)        
        {
            SlidePart slidePart1 = presentationPart.AddNewPart<SlidePart>("rId2");
                slidePart1.Slide = new Slide(
                        new CommonSlideData(
                            new ShapeTree(
                                new DocumentFormat.OpenXml.Presentation.NonVisualGroupShapeProperties(
                                    new DocumentFormat.OpenXml.Presentation.NonVisualDrawingProperties() { Id = (UInt32Value)1U, Name = "" },
                                    new DocumentFormat.OpenXml.Presentation.NonVisualGroupShapeDrawingProperties(),
                                    new ApplicationNonVisualDrawingProperties()),
                                new GroupShapeProperties(new TransformGroup()),
                                new DocumentFormat.OpenXml.Presentation.Shape(
                                    new DocumentFormat.OpenXml.Presentation.NonVisualShapeProperties(
                                        new DocumentFormat.OpenXml.Presentation.NonVisualDrawingProperties() { Id = (UInt32Value)2U, Name = "Title 1" },
                                        new DocumentFormat.OpenXml.Presentation.NonVisualShapeDrawingProperties(new ShapeLocks() { NoGrouping = true }),
                                        new ApplicationNonVisualDrawingProperties(new PlaceholderShape())),
                                    new DocumentFormat.OpenXml.Presentation.ShapeProperties(),
                                    new DocumentFormat.OpenXml.Presentation.TextBody(
                                        new BodyProperties(),
                                        new ListStyle(),
                                        new Paragraph(new EndParagraphRunProperties() { Language = "en-US" }))))),
                        new ColorMapOverride(new MasterColorMapping()));
                return slidePart1;
         } 
   
      private static SlideLayoutPart CreateSlideLayoutPart(SlidePart slidePart1)
        {
            SlideLayoutPart slideLayoutPart1 = slidePart1.AddNewPart<SlideLayoutPart>("rId1");
            SlideLayout slideLayout = new SlideLayout(
            new CommonSlideData(new ShapeTree(
              new DocumentFormat.OpenXml.Presentation.NonVisualGroupShapeProperties(
              new DocumentFormat.OpenXml.Presentation.NonVisualDrawingProperties() { Id = (UInt32Value)1U, Name = "" },
              new DocumentFormat.OpenXml.Presentation.NonVisualGroupShapeDrawingProperties(),
              new ApplicationNonVisualDrawingProperties()),
              new GroupShapeProperties(new TransformGroup()),
              new DocumentFormat.OpenXml.Presentation.Shape(
              new DocumentFormat.OpenXml.Presentation.NonVisualShapeProperties(
                new DocumentFormat.OpenXml.Presentation.NonVisualDrawingProperties() { Id = (UInt32Value)2U, Name = "" },
                new DocumentFormat.OpenXml.Presentation.NonVisualShapeDrawingProperties(new ShapeLocks() { NoGrouping = true }),
                new ApplicationNonVisualDrawingProperties(new PlaceholderShape())),
              new DocumentFormat.OpenXml.Presentation.ShapeProperties(),
              new DocumentFormat.OpenXml.Presentation.TextBody(
                new BodyProperties(),
                new ListStyle(),
                new Paragraph(new EndParagraphRunProperties()))))),
            new ColorMapOverride(new MasterColorMapping()));
            slideLayoutPart1.SlideLayout = slideLayout;
            return slideLayoutPart1;
         }

   private static SlideMasterPart CreateSlideMasterPart(SlideLayoutPart slideLayoutPart1)
   {
       SlideMasterPart slideMasterPart1 = slideLayoutPart1.AddNewPart<SlideMasterPart>("rId1");
       SlideMaster slideMaster = new SlideMaster(
       new CommonSlideData(new ShapeTree(
         new DocumentFormat.OpenXml.Presentation.NonVisualGroupShapeProperties(
         new DocumentFormat.OpenXml.Presentation.NonVisualDrawingProperties() { Id = (UInt32Value)1U, Name = "" },
         new DocumentFormat.OpenXml.Presentation.NonVisualGroupShapeDrawingProperties(),
         new ApplicationNonVisualDrawingProperties()),
         new GroupShapeProperties(new TransformGroup()),
         new DocumentFormat.OpenXml.Presentation.Shape(
         new DocumentFormat.OpenXml.Presentation.NonVisualShapeProperties(
           new DocumentFormat.OpenXml.Presentation.NonVisualDrawingProperties() { Id = (UInt32Value)2U, Name = "Title Placeholder 1" },
           new DocumentFormat.OpenXml.Presentation.NonVisualShapeDrawingProperties(new ShapeLocks() { NoGrouping = true }),
           new ApplicationNonVisualDrawingProperties(new PlaceholderShape() { Type = PlaceholderValues.Title })),
         new DocumentFormat.OpenXml.Presentation.ShapeProperties(),
         new DocumentFormat.OpenXml.Presentation.TextBody(
           new BodyProperties(),
           new ListStyle(),
           new Paragraph())))),
       new DocumentFormat.OpenXml.Presentation.ColorMap() { Background1 = DocumentFormat.OpenXml.Drawing.ColorSchemeIndexValues.Light1, Text1 = DocumentFormat.OpenXml.Drawing.ColorSchemeIndexValues.Dark1, Background2 = DocumentFormat.OpenXml.Drawing.ColorSchemeIndexValues.Light2, Text2 = DocumentFormat.OpenXml.Drawing.ColorSchemeIndexValues.Dark2, Accent1 = DocumentFormat.OpenXml.Drawing.ColorSchemeIndexValues.Accent1, Accent2 = DocumentFormat.OpenXml.Drawing.ColorSchemeIndexValues.Accent2, Accent3 = DocumentFormat.OpenXml.Drawing.ColorSchemeIndexValues.Accent3, Accent4 = DocumentFormat.OpenXml.Drawing.ColorSchemeIndexValues.Accent4, Accent5 = DocumentFormat.OpenXml.Drawing.ColorSchemeIndexValues.Accent5, Accent6 = DocumentFormat.OpenXml.Drawing.ColorSchemeIndexValues.Accent6, Hyperlink = DocumentFormat.OpenXml.Drawing.ColorSchemeIndexValues.Hyperlink, FollowedHyperlink = DocumentFormat.OpenXml.Drawing.ColorSchemeIndexValues.FollowedHyperlink },
       new SlideLayoutIdList(new SlideLayoutId() { Id = (UInt32Value)2147483649U, RelationshipId = "rId1" }),
       new TextStyles(new DocumentFormat.OpenXml.Presentation.TitleStyle(), new BodyStyle(), new OtherStyle()));
       slideMasterPart1.SlideMaster = slideMaster;

       return slideMasterPart1;
    }

   private static ThemePart CreateTheme(SlideMasterPart slideMasterPart1)
   {
       ThemePart themePart1 = slideMasterPart1.AddNewPart<ThemePart>("rId5");
       DocumentFormat.OpenXml.Drawing.Theme theme1 = new DocumentFormat.OpenXml.Drawing.Theme() { Name = "Office Theme" };

       DocumentFormat.OpenXml.Drawing.ThemeElements themeElements1 = new DocumentFormat.OpenXml.Drawing.ThemeElements(
       new DocumentFormat.OpenXml.Drawing.ColorScheme(
         new DocumentFormat.OpenXml.Drawing.Dark1Color(new DocumentFormat.OpenXml.Drawing.SystemColor() { Val = DocumentFormat.OpenXml.Drawing.SystemColorValues.WindowText, LastColor = "000000" }),
         new DocumentFormat.OpenXml.Drawing.Light1Color(new DocumentFormat.OpenXml.Drawing.SystemColor() { Val = DocumentFormat.OpenXml.Drawing.SystemColorValues.Window, LastColor = "FFFFFF" }),
         new DocumentFormat.OpenXml.Drawing.Dark2Color(new DocumentFormat.OpenXml.Drawing.RgbColorModelHex() { Val = "1F497D" }),
         new DocumentFormat.OpenXml.Drawing.Light2Color(new DocumentFormat.OpenXml.Drawing.RgbColorModelHex() { Val = "EEECE1" }),
         new DocumentFormat.OpenXml.Drawing.Accent1Color(new DocumentFormat.OpenXml.Drawing.RgbColorModelHex() { Val = "4F81BD" }),
         new DocumentFormat.OpenXml.Drawing.Accent2Color(new DocumentFormat.OpenXml.Drawing.RgbColorModelHex() { Val = "C0504D" }),
         new DocumentFormat.OpenXml.Drawing.Accent3Color(new DocumentFormat.OpenXml.Drawing.RgbColorModelHex() { Val = "9BBB59" }),
         new DocumentFormat.OpenXml.Drawing.Accent4Color(new DocumentFormat.OpenXml.Drawing.RgbColorModelHex() { Val = "8064A2" }),
         new DocumentFormat.OpenXml.Drawing.Accent5Color(new DocumentFormat.OpenXml.Drawing.RgbColorModelHex() { Val = "4BACC6" }),
         new DocumentFormat.OpenXml.Drawing.Accent6Color(new DocumentFormat.OpenXml.Drawing.RgbColorModelHex() { Val = "F79646" }),
         new DocumentFormat.OpenXml.Drawing.Hyperlink(new DocumentFormat.OpenXml.Drawing.RgbColorModelHex() { Val = "0000FF" }),
         new DocumentFormat.OpenXml.Drawing.FollowedHyperlinkColor(new DocumentFormat.OpenXml.Drawing.RgbColorModelHex() { Val = "800080" })) { Name = "Office" },
         new DocumentFormat.OpenXml.Drawing.FontScheme(
         new DocumentFormat.OpenXml.Drawing.MajorFont(
         new DocumentFormat.OpenXml.Drawing.LatinFont() { Typeface = "Calibri" },
         new DocumentFormat.OpenXml.Drawing.EastAsianFont() { Typeface = "" },
         new DocumentFormat.OpenXml.Drawing.ComplexScriptFont() { Typeface = "" }),
         new DocumentFormat.OpenXml.Drawing.MinorFont(
         new DocumentFormat.OpenXml.Drawing.LatinFont() { Typeface = "Calibri" },
         new DocumentFormat.OpenXml.Drawing.EastAsianFont() { Typeface = "" },
         new DocumentFormat.OpenXml.Drawing.ComplexScriptFont() { Typeface = "" })) { Name = "Office" },
         new DocumentFormat.OpenXml.Drawing.FormatScheme(
         new DocumentFormat.OpenXml.Drawing.FillStyleList(
         new DocumentFormat.OpenXml.Drawing.SolidFill(new DocumentFormat.OpenXml.Drawing.SchemeColor() { Val = DocumentFormat.OpenXml.Drawing.SchemeColorValues.PhColor }),
         new DocumentFormat.OpenXml.Drawing.GradientFill(
           new DocumentFormat.OpenXml.Drawing.GradientStopList(
           new DocumentFormat.OpenXml.Drawing.GradientStop(new DocumentFormat.OpenXml.Drawing.SchemeColor(new DocumentFormat.OpenXml.Drawing.Tint() { Val = 50000 },
             new DocumentFormat.OpenXml.Drawing.SaturationModulation() { Val = 300000 }) { Val = DocumentFormat.OpenXml.Drawing.SchemeColorValues.PhColor }) { Position = 0 },
           new DocumentFormat.OpenXml.Drawing.GradientStop(new DocumentFormat.OpenXml.Drawing.SchemeColor(new DocumentFormat.OpenXml.Drawing.Tint() { Val = 37000 },
            new DocumentFormat.OpenXml.Drawing.SaturationModulation() { Val = 300000 }) { Val = DocumentFormat.OpenXml.Drawing.SchemeColorValues.PhColor }) { Position = 35000 },
           new DocumentFormat.OpenXml.Drawing.GradientStop(new DocumentFormat.OpenXml.Drawing.SchemeColor(new DocumentFormat.OpenXml.Drawing.Tint() { Val = 15000 },
            new DocumentFormat.OpenXml.Drawing.SaturationModulation() { Val = 350000 }) { Val = DocumentFormat.OpenXml.Drawing.SchemeColorValues.PhColor }) { Position = 100000 }
           ),
           new DocumentFormat.OpenXml.Drawing.LinearGradientFill() { Angle = 16200000, Scaled = true }),
         new DocumentFormat.OpenXml.Drawing.NoFill(),
         new DocumentFormat.OpenXml.Drawing.PatternFill(),
         new DocumentFormat.OpenXml.Drawing.GroupFill()),
         new DocumentFormat.OpenXml.Drawing.LineStyleList(
         new DocumentFormat.OpenXml.Drawing.Outline(
           new DocumentFormat.OpenXml.Drawing.SolidFill(
           new DocumentFormat.OpenXml.Drawing.SchemeColor(
             new DocumentFormat.OpenXml.Drawing.Shade() { Val = 95000 },
             new DocumentFormat.OpenXml.Drawing.SaturationModulation() { Val = 105000 }) { Val = DocumentFormat.OpenXml.Drawing.SchemeColorValues.PhColor }),
           new DocumentFormat.OpenXml.Drawing.PresetDash() { Val = DocumentFormat.OpenXml.Drawing.PresetLineDashValues.Solid })
         {
             Width = 9525,
             CapType = DocumentFormat.OpenXml.Drawing.LineCapValues.Flat,
             CompoundLineType = DocumentFormat.OpenXml.Drawing.CompoundLineValues.Single,
             Alignment = DocumentFormat.OpenXml.Drawing.PenAlignmentValues.Center
         },
         new DocumentFormat.OpenXml.Drawing.Outline(
           new DocumentFormat.OpenXml.Drawing.SolidFill(
           new DocumentFormat.OpenXml.Drawing.SchemeColor(
             new DocumentFormat.OpenXml.Drawing.Shade() { Val = 95000 },
             new DocumentFormat.OpenXml.Drawing.SaturationModulation() { Val = 105000 }) { Val = DocumentFormat.OpenXml.Drawing.SchemeColorValues.PhColor }),
           new DocumentFormat.OpenXml.Drawing.PresetDash() { Val = DocumentFormat.OpenXml.Drawing.PresetLineDashValues.Solid })
         {
             Width = 9525,
             CapType = DocumentFormat.OpenXml.Drawing.LineCapValues.Flat,
             CompoundLineType = DocumentFormat.OpenXml.Drawing.CompoundLineValues.Single,
             Alignment = DocumentFormat.OpenXml.Drawing.PenAlignmentValues.Center
         },
         new DocumentFormat.OpenXml.Drawing.Outline(
           new DocumentFormat.OpenXml.Drawing.SolidFill(
           new DocumentFormat.OpenXml.Drawing.SchemeColor(
             new DocumentFormat.OpenXml.Drawing.Shade() { Val = 95000 },
             new DocumentFormat.OpenXml.Drawing.SaturationModulation() { Val = 105000 }) { Val = DocumentFormat.OpenXml.Drawing.SchemeColorValues.PhColor }),
           new DocumentFormat.OpenXml.Drawing.PresetDash() { Val = DocumentFormat.OpenXml.Drawing.PresetLineDashValues.Solid })
         {
             Width = 9525,
             CapType = DocumentFormat.OpenXml.Drawing.LineCapValues.Flat,
             CompoundLineType = DocumentFormat.OpenXml.Drawing.CompoundLineValues.Single,
             Alignment = DocumentFormat.OpenXml.Drawing.PenAlignmentValues.Center
         }),
         new DocumentFormat.OpenXml.Drawing.EffectStyleList(
         new DocumentFormat.OpenXml.Drawing.EffectStyle(
           new DocumentFormat.OpenXml.Drawing.EffectList(
           new DocumentFormat.OpenXml.Drawing.OuterShadow(
             new DocumentFormat.OpenXml.Drawing.RgbColorModelHex(
             new DocumentFormat.OpenXml.Drawing.Alpha() { Val = 38000 }) { Val = "000000" }) { BlurRadius = 40000L, Distance = 20000L, Direction = 5400000, RotateWithShape = false })),
         new DocumentFormat.OpenXml.Drawing.EffectStyle(
           new DocumentFormat.OpenXml.Drawing.EffectList(
           new DocumentFormat.OpenXml.Drawing.OuterShadow(
             new DocumentFormat.OpenXml.Drawing.RgbColorModelHex(
             new DocumentFormat.OpenXml.Drawing.Alpha() { Val = 38000 }) { Val = "000000" }) { BlurRadius = 40000L, Distance = 20000L, Direction = 5400000, RotateWithShape = false })),
         new DocumentFormat.OpenXml.Drawing.EffectStyle(
           new DocumentFormat.OpenXml.Drawing.EffectList(
           new DocumentFormat.OpenXml.Drawing.OuterShadow(
             new DocumentFormat.OpenXml.Drawing.RgbColorModelHex(
             new DocumentFormat.OpenXml.Drawing.Alpha() { Val = 38000 }) { Val = "000000" }) { BlurRadius = 40000L, Distance = 20000L, Direction = 5400000, RotateWithShape = false }))),
         new DocumentFormat.OpenXml.Drawing.BackgroundFillStyleList(
         new DocumentFormat.OpenXml.Drawing.SolidFill(new DocumentFormat.OpenXml.Drawing.SchemeColor() { Val = DocumentFormat.OpenXml.Drawing.SchemeColorValues.PhColor }),
         new DocumentFormat.OpenXml.Drawing.GradientFill(
           new DocumentFormat.OpenXml.Drawing.GradientStopList(
           new DocumentFormat.OpenXml.Drawing.GradientStop(
             new DocumentFormat.OpenXml.Drawing.SchemeColor(new DocumentFormat.OpenXml.Drawing.Tint() { Val = 50000 },
               new DocumentFormat.OpenXml.Drawing.SaturationModulation() { Val = 300000 }) { Val = DocumentFormat.OpenXml.Drawing.SchemeColorValues.PhColor }) { Position = 0 },
           new DocumentFormat.OpenXml.Drawing.GradientStop(
             new DocumentFormat.OpenXml.Drawing.SchemeColor(new DocumentFormat.OpenXml.Drawing.Tint() { Val = 50000 },
               new DocumentFormat.OpenXml.Drawing.SaturationModulation() { Val = 300000 }) { Val = DocumentFormat.OpenXml.Drawing.SchemeColorValues.PhColor }) { Position = 0 },
           new DocumentFormat.OpenXml.Drawing.GradientStop(
             new DocumentFormat.OpenXml.Drawing.SchemeColor(new DocumentFormat.OpenXml.Drawing.Tint() { Val = 50000 },
               new DocumentFormat.OpenXml.Drawing.SaturationModulation() { Val = 300000 }) { Val = DocumentFormat.OpenXml.Drawing.SchemeColorValues.PhColor }) { Position = 0 }),
           new DocumentFormat.OpenXml.Drawing.LinearGradientFill() { Angle = 16200000, Scaled = true }),
         new DocumentFormat.OpenXml.Drawing.GradientFill(
           new DocumentFormat.OpenXml.Drawing.GradientStopList(
           new DocumentFormat.OpenXml.Drawing.GradientStop(
             new DocumentFormat.OpenXml.Drawing.SchemeColor(new DocumentFormat.OpenXml.Drawing.Tint() { Val = 50000 },
               new DocumentFormat.OpenXml.Drawing.SaturationModulation() { Val = 300000 }) { Val = DocumentFormat.OpenXml.Drawing.SchemeColorValues.PhColor }) { Position = 0 },
           new DocumentFormat.OpenXml.Drawing.GradientStop(
             new DocumentFormat.OpenXml.Drawing.SchemeColor(new DocumentFormat.OpenXml.Drawing.Tint() { Val = 50000 },
               new DocumentFormat.OpenXml.Drawing.SaturationModulation() { Val = 300000 }) { Val = DocumentFormat.OpenXml.Drawing.SchemeColorValues.PhColor }) { Position = 0 }),
           new DocumentFormat.OpenXml.Drawing.LinearGradientFill() { Angle = 16200000, Scaled = true }))) { Name = "Office" });

       theme1.Append(themeElements1);
       theme1.Append(new DocumentFormat.OpenXml.Drawing.ObjectDefaults());
       theme1.Append(new DocumentFormat.OpenXml.Drawing.ExtraColorSchemeList());

       themePart1.Theme = theme1;
       return themePart1;

         }



   public static void InsertNewSlide(PresentationDocument presentationDocument, int position, string slideTitle)
   {


       PresentationPart presentationPart = presentationDocument.PresentationPart;
       Slide slide = new Slide(new CommonSlideData(new ShapeTree()));
       uint drawingObjectId = 1;

       DocumentFormat.OpenXml.Presentation.NonVisualGroupShapeProperties nonVisualProperties = slide.CommonSlideData.ShapeTree.AppendChild(new DocumentFormat.OpenXml.Presentation.NonVisualGroupShapeProperties());
       nonVisualProperties.NonVisualDrawingProperties = new DocumentFormat.OpenXml.Presentation.NonVisualDrawingProperties() { Id = 1, Name = "" };
       nonVisualProperties.NonVisualGroupShapeDrawingProperties = new DocumentFormat.OpenXml.Presentation.NonVisualGroupShapeDrawingProperties();
       nonVisualProperties.ApplicationNonVisualDrawingProperties = new ApplicationNonVisualDrawingProperties();
       slide.CommonSlideData.ShapeTree.AppendChild(new GroupShapeProperties());

       DocumentFormat.OpenXml.Presentation.Shape titleShape = slide.CommonSlideData.ShapeTree.AppendChild(new DocumentFormat.OpenXml.Presentation.Shape());

       drawingObjectId++;

       titleShape.NonVisualShapeProperties = new DocumentFormat.OpenXml.Presentation.NonVisualShapeProperties
           (new DocumentFormat.OpenXml.Presentation.NonVisualDrawingProperties() { Id = drawingObjectId, Name = "Title" },
           new DocumentFormat.OpenXml.Presentation.NonVisualShapeDrawingProperties(new DocumentFormat.OpenXml.Drawing.ShapeLocks() { NoGrouping = true }),
           new ApplicationNonVisualDrawingProperties(new PlaceholderShape() { Type = PlaceholderValues.Title }));
       titleShape.ShapeProperties = new DocumentFormat.OpenXml.Presentation.ShapeProperties();

       titleShape.TextBody = new DocumentFormat.OpenXml.Presentation.TextBody(new DocumentFormat.OpenXml.Drawing.BodyProperties(),
               new DocumentFormat.OpenXml.Drawing.ListStyle(),
               new DocumentFormat.OpenXml.Drawing.Paragraph(new DocumentFormat.OpenXml.Drawing.Run(new DocumentFormat.OpenXml.Drawing.Text() { Text = slideTitle })));

       DocumentFormat.OpenXml.Presentation.Shape bodyShape = slide.CommonSlideData.ShapeTree.AppendChild(new DocumentFormat.OpenXml.Presentation.Shape());
       drawingObjectId++;

       bodyShape.NonVisualShapeProperties = new DocumentFormat.OpenXml.Presentation.NonVisualShapeProperties(new DocumentFormat.OpenXml.Presentation.NonVisualDrawingProperties() { Id = drawingObjectId, Name = "Content Placeholder" },
               new DocumentFormat.OpenXml.Presentation.NonVisualShapeDrawingProperties(new DocumentFormat.OpenXml.Drawing.ShapeLocks() { NoGrouping = true }),
               new ApplicationNonVisualDrawingProperties(new PlaceholderShape() { Index = 1 }));
       bodyShape.ShapeProperties = new DocumentFormat.OpenXml.Presentation.ShapeProperties();


       bodyShape.TextBody = new DocumentFormat.OpenXml.Presentation.TextBody(new DocumentFormat.OpenXml.Drawing.BodyProperties(),
               new DocumentFormat.OpenXml.Drawing.ListStyle(),
               new DocumentFormat.OpenXml.Drawing.Paragraph());

       SlidePart slidePart = presentationPart.AddNewPart<SlidePart>();

       slide.Save(slidePart);

       SlideIdList slideIdList = presentationPart.Presentation.SlideIdList;

       uint maxSlideId = 1;
       SlideId prevSlideId = null;

       foreach (SlideId slideId in slideIdList.ChildElements)
       {
           if (slideId.Id > maxSlideId)
           {
               maxSlideId = slideId.Id;
           }

           position--;
           if (position == 0)
           {
               prevSlideId = slideId;
           }

       }

       maxSlideId++;

       SlidePart lastSlidePart;

       if (prevSlideId != null)
       {
           lastSlidePart = (SlidePart)presentationPart.GetPartById(prevSlideId.RelationshipId);
       }
       else
       {
           lastSlidePart = (SlidePart)presentationPart.GetPartById(((SlideId)(slideIdList.ChildElements[0])).RelationshipId);
       }

       if (null != lastSlidePart.SlideLayoutPart)
       {
           slidePart.AddPart(lastSlidePart.SlideLayoutPart);
       }


       SlideId newSlideId = slideIdList.InsertAfter(new SlideId(), prevSlideId);
       newSlideId.Id = maxSlideId;
       newSlideId.RelationshipId = presentationPart.GetIdOfPart(slidePart);

       presentationPart.Presentation.Save();
   }


   public static void InsertNewSlide(string presentationFile, int position, string slideTitle)
   {

           InsertNewSlide(@"C:\MyTest.pptx", 1, "My new slide");

   }