Exemplo n.º 1
0
        // Insert the specified slide into the presentation at the specified position.
        public static void InsertNewSlide(PresentationDocument presentationDocument, int position, string slideTitle, string slideContent)
        {
            if (presentationDocument == null)
            {
                throw new ArgumentNullException("presentationDocument");
            }

            if (slideTitle == null)
            {
                throw new ArgumentNullException("slideTitle");
            }

            PresentationPart presentationPart = presentationDocument.PresentationPart;

            // Verify that the presentation is not empty.
            if (presentationPart == null)
            {
                throw new InvalidOperationException("The presentation document is empty.");
            }

            // Declare and instantiate a new slide.
            Slide slide           = new Slide(new CommonSlideData(new ShapeTree()));
            uint  drawingObjectId = 1;

            // Construct the slide content.
            // Specify the non-visual properties of the new slide.
            NonVisualGroupShapeProperties nonVisualProperties = slide.CommonSlideData.ShapeTree.AppendChild(new NonVisualGroupShapeProperties());

            nonVisualProperties.NonVisualDrawingProperties = new NonVisualDrawingProperties()
            {
                Id = 1, Name = ""
            };
            nonVisualProperties.NonVisualGroupShapeDrawingProperties  = new NonVisualGroupShapeDrawingProperties();
            nonVisualProperties.ApplicationNonVisualDrawingProperties = new ApplicationNonVisualDrawingProperties();

            // Specify the group shape properties of the new slide.
            slide.CommonSlideData.ShapeTree.AppendChild(new GroupShapeProperties());

            // Declare and instantiate the title shape of the new slide.
            Shape titleShape = slide.CommonSlideData.ShapeTree.AppendChild(new Shape());

            drawingObjectId++;

            // Specify the required shape properties for the title shape.
            titleShape.NonVisualShapeProperties = new NonVisualShapeProperties
                                                      (new NonVisualDrawingProperties()
            {
                Id = drawingObjectId, Name = "Title"
            },
                                                      new NonVisualShapeDrawingProperties(new Drawing.ShapeLocks()
            {
                NoGrouping = true
            }),
                                                      new ApplicationNonVisualDrawingProperties(new PlaceholderShape()
            {
                Index = 0, Type = PlaceholderValues.Title
            }));
            titleShape.ShapeProperties = new ShapeProperties();

            // Specify the text of the title shape.
            titleShape.TextBody = new TextBody(new Drawing.BodyProperties(),
                                               new Drawing.ListStyle(),
                                               new Drawing.Paragraph(new Drawing.Run(new Drawing.Text()
            {
                Text = slideTitle
            })));

            // Declare and instantiate the body shape of the new slide.
            Shape bodyShape = slide.CommonSlideData.ShapeTree.AppendChild(new Shape());

            drawingObjectId++;

            // Specify the required shape properties for the body shape.
            bodyShape.NonVisualShapeProperties = new NonVisualShapeProperties
                                                     (new NonVisualDrawingProperties()
            {
                Id = drawingObjectId, Name = "Content"
            },
                                                     new NonVisualShapeDrawingProperties(new Drawing.ShapeLocks()
            {
                NoGrouping = true
            }),
                                                     new ApplicationNonVisualDrawingProperties(new PlaceholderShape()
            {
                Index = 1
            }));
            bodyShape.ShapeProperties = new ShapeProperties();

            // Specify the text of the body shape.
            bodyShape.TextBody = new TextBody(new Drawing.BodyProperties(),
                                              new Drawing.ListStyle(),
                                              new Drawing.Paragraph(new Drawing.Run(new Drawing.Text()
            {
                Text = slideContent
            })));

            // Create the slide part for the new slide.
            SlidePart slidePart = presentationPart.AddNewPart <SlidePart>();

            // Save the new slide part.
            slide.Save(slidePart);

            // Modify the slide ID list in the presentation part.
            // The slide ID list should not be null.
            SlideIdList slideIdList = presentationPart.Presentation.SlideIdList;

            // Find the highest slide ID in the current list.
            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++;

            // Get the ID of the previous slide.
            SlidePart lastSlidePart;

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

            // Use the same slide layout as that of the previous slide.
            if (null != lastSlidePart.SlideLayoutPart)
            {
                slidePart.AddPart(lastSlidePart.SlideLayoutPart);
            }

            // Insert the new slide into the slide list after the previous slide.
            SlideId newSlideId = slideIdList.InsertAfter(new SlideId(), prevSlideId);

            newSlideId.Id             = maxSlideId;
            newSlideId.RelationshipId = presentationPart.GetIdOfPart(slidePart);

            // Save the modified presentation.
            presentationPart.Presentation.Save();
        }
Exemplo n.º 2
0
        // Insert the specified slide into the presentation at the specified position.
        public static Slide InsertNewSlide(PresentationDocument presentationDocument, int position, string slideTitle, FileInfo ChartFile)
        {
            if (presentationDocument == null)
            {
                throw new ArgumentNullException("presentationDocument");
            }

            if (slideTitle == null)
            {
                throw new ArgumentNullException("slideTitle");
            }

            PresentationPart presentationPart = presentationDocument.PresentationPart;

            // Verify that the presentation is not empty.
            if (presentationPart == null)
            {
                throw new InvalidOperationException("The presentation document is empty.");
            }

            // Declare and instantiate a new slide.
            Slide slide = new Slide(new CommonSlideData(new ShapeTree()));
            //uint drawingObjectId = 1;

            // Construct the slide content.
            // Specify the non-visual properties of the new slide.
            NonVisualGroupShapeProperties nonVisualProperties = slide.CommonSlideData.ShapeTree.AppendChild(new NonVisualGroupShapeProperties());

            nonVisualProperties.NonVisualDrawingProperties = new NonVisualDrawingProperties()
            {
                Id = 1, Name = ""
            };
            nonVisualProperties.NonVisualGroupShapeDrawingProperties  = new NonVisualGroupShapeDrawingProperties();
            nonVisualProperties.ApplicationNonVisualDrawingProperties = new ApplicationNonVisualDrawingProperties();

            // Specify the group shape properties of the new slide.
            slide.CommonSlideData.ShapeTree.AppendChild(new GroupShapeProperties());

            //// Declare and instantiate the title shape of the new slide.
            //DocumentFormat.OpenXml.Presentation.Shape titleShape = slide.CommonSlideData.ShapeTree.AppendChild(new DocumentFormat.OpenXml.Presentation.Shape());

            //drawingObjectId++;

            //// Specify the required shape properties for the title shape.
            //titleShape.NonVisualShapeProperties = new NonVisualShapeProperties
            //    (new NonVisualDrawingProperties() { Id = drawingObjectId, Name = "Title" },
            //    new NonVisualShapeDrawingProperties(new Drawing.ShapeLocks() { NoGrouping = true }),
            //    new ApplicationNonVisualDrawingProperties(new PlaceholderShape() { Type = PlaceholderValues.Title }));
            //titleShape.ShapeProperties = new DocumentFormat.OpenXml.Presentation.ShapeProperties();

            //// Specify the text of the title shape.
            //titleShape.TextBody = new TextBody(new Drawing.BodyProperties(),
            //        new Drawing.ListStyle(),
            //        new Drawing.Paragraph(new Drawing.Run(new Drawing.Text() { Text = slideTitle })));


            //// Declare and instantiate the body shape of the new slide.
            //DocumentFormat.OpenXml.Presentation.Shape bodyShape = slide.CommonSlideData.ShapeTree.AppendChild(new DocumentFormat.OpenXml.Presentation.Shape());
            //drawingObjectId++;

            //// Specify the required shape properties for the body shape.
            //bodyShape.NonVisualShapeProperties = new NonVisualShapeProperties(new NonVisualDrawingProperties() { Id = drawingObjectId, Name = "Content Placeholder" },
            //        new NonVisualShapeDrawingProperties(new Drawing.ShapeLocks() { NoGrouping = true }),
            //        new ApplicationNonVisualDrawingProperties(new PlaceholderShape() { Index = 1 }));
            //bodyShape.ShapeProperties = new DocumentFormat.OpenXml.Presentation.ShapeProperties();

            //// Specify the text of the body shape.
            //bodyShape.TextBody = new TextBody(new Drawing.BodyProperties(),
            //        new Drawing.ListStyle(),
            //        new Drawing.Paragraph());

            // Declare and instantiate the body shape of the new slide.
            //DocumentFormat.OpenXml.Presentation.Shape ImgShape = slide.CommonSlideData.ShapeTree.AppendChild(new DocumentFormat.OpenXml.Presentation.Shape());
            //drawingObjectId++;

            // Specify the required shape properties for the body shape.
            //ImgShape.NonVisualShapeProperties = new NonVisualShapeProperties(new NonVisualDrawingProperties() { Id = drawingObjectId, Name = "" },
            //        new NonVisualGroupShapeDrawingProperties(),
            //        new ApplicationNonVisualDrawingProperties());
            //ImgShape.ShapeProperties = new DocumentFormat.OpenXml.Presentation.ShapeProperties();

            // Specify the text of the body shape.
            //ImgShape.TextBody = new TextBody(new Drawing.BodyProperties(),
            //        new Drawing.ListStyle(),
            //        new Drawing.Paragraph());

            //Drawing.Picture picture = new Drawing.Picture();
            ////string embedId = string.Empty;
            //string embedId = "rId" + (slide.Elements().Count() + 915).ToString();
            //Drawing.NonVisualPictureProperties nonVisualPictureProperties = new Drawing.NonVisualPictureProperties(
            //    new Drawing.NonVisualDrawingProperties() { Id = (UInt32Value)4U, Name = "Picture" + ChartFile.Name },
            //    new Drawing.NonVisualPictureDrawingProperties(new Drawing.PictureLocks() { NoChangeAspect = true }),
            //    new ApplicationNonVisualDrawingProperties());


            //BlipFill blipFill1 = new BlipFill();
            //Drawing.Blip blip1 = new Drawing.Blip() { Embed = embedId, CompressionState = Drawing.BlipCompressionValues.Print };

            //// Creates an BlipExtensionList instance and adds its children
            //Drawing.BlipExtensionList blipExtensionList = new Drawing.BlipExtensionList();
            //Drawing.BlipExtension blipExtension = new Drawing.BlipExtension() { Uri = "{28A0092B-C50C-407E-A947-70E740481C1C}" };

            //A14.UseLocalDpi useLocalDpi = new A14.UseLocalDpi() { Val = false };
            //useLocalDpi.AddNamespaceDeclaration("a14",
            //    "http://schemas.microsoft.com/office/drawing/2010/main");

            //blipExtension.Append(useLocalDpi);
            //blipExtensionList.Append(blipExtension);
            //blip1.Append(blipExtensionList);


            //Drawing.Stretch stretch1 = new Drawing.Stretch();
            //Drawing.FillRectangle fillRectangle1 = new Drawing.FillRectangle();
            //stretch1.Append(fillRectangle1);

            //blipFill1.Append(blip1);
            //blipFill1.Append(stretch1);

            //Drawing.ShapeProperties shapeProperties = new Drawing.ShapeProperties();

            //Drawing.Transform2D transform2D = new Drawing.Transform2D();
            //Drawing.Offset offset = new Drawing.Offset() { X = 0L, Y = 0L };
            //Drawing.Extents extents = new Drawing.Extents() { Cx = 8000000L, Cy = 6000000L };

            //transform2D.Append(offset);
            //transform2D.Append(extents);


            //Drawing.PresetGeometry presetGeometry = new Drawing.PresetGeometry() { Preset = Drawing.ShapeTypeValues.Rectangle };
            //Drawing.AdjustValueList adjustValueList = new Drawing.AdjustValueList();


            //presetGeometry.Append(adjustValueList);


            //shapeProperties.Append(transform2D);
            //shapeProperties.Append(presetGeometry);


            //picture.Append(nonVisualPictureProperties);
            //picture.Append(blipFill1);
            //picture.Append(shapeProperties);


            //slide.CommonSlideData.ShapeTree.AppendChild(picture);



            // Create the slide part for the new slide.
            SlidePart slidePart = presentationPart.AddNewPart <SlidePart>();

            // Save the new slide part.
            slide.Save(slidePart);

            // Modify the slide ID list in the presentation part.
            // The slide ID list should not be null.
            SlideIdList slideIdList = presentationPart.Presentation.SlideIdList;

            // Find the highest slide ID in the current list.
            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++;

            // Get the ID of the previous slide.
            SlidePart lastSlidePart;

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

            // Use the same slide layout as that of the previous slide.
            if (null != lastSlidePart.SlideLayoutPart)
            {
                slidePart.AddPart(lastSlidePart.SlideLayoutPart);
            }

            // Insert the new slide into the slide list after the previous slide.
            SlideId newSlideId = slideIdList.InsertAfter(new SlideId(), prevSlideId);

            newSlideId.Id             = maxSlideId;
            newSlideId.RelationshipId = presentationPart.GetIdOfPart(slidePart);

            // Save the modified presentation.
            //presentationPart.Presentation.Save();

            return(GetSlideByRelationShipId(presentationPart, newSlideId.RelationshipId));
        }
Exemplo n.º 3
0
        // Insert the specified slide into the presentation at the specified position.
        public void InsertNewSlide(PresentationPart presentationPart)
        {
            // Verify that the presentation is not empty.
            if (presentationPart == null)
            {
                throw new InvalidOperationException("The presentation document is empty.");
            }

            // Declare and instantiate a new slide.
            Slide slide = new Slide(new CommonSlideData(new P.ShapeTree()));

            // Specify the group shape properties of the new slide.
            slide.CommonSlideData.ShapeTree.AppendChild(new P.GroupShapeProperties());

            // Create the slide part for the new slide.
            SlidePart slidePart = presentationPart.AddNewPart <SlidePart>();

            // Save the new slide part.
            slide.Save(slidePart);

            // Modify the slide ID list in the presentation part.
            // The slide ID list should not be null.
            SlideIdList slideIdList = presentationPart.Presentation.SlideIdList;

            // Find the highest slide ID in the current list.
            uint    maxSlideId  = Convert.ToUInt32(slideIdList.ChildElements.Count());
            int     position    = slideIdList.ChildElements.Count();
            SlideId prevSlideId = null;

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

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

            maxSlideId++;

            // Get the ID of the previous slide.
            SlidePart lastSlidePart;

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

            // Use the same slide layout as that of the previous slide.
            if (null != lastSlidePart.SlideLayoutPart)
            {
                slidePart.AddPart(lastSlidePart.SlideLayoutPart);
            }

            // Insert the new slide into the slide list after the previous slide.
            SlideId newSlideId = slideIdList.InsertAfter(new SlideId(), prevSlideId);

            newSlideId.Id             = maxSlideId;
            newSlideId.RelationshipId = presentationPart.GetIdOfPart(slidePart);

            // Save the modified presentation.
            presentationPart.Presentation.Save();
        }
Exemplo n.º 4
0
        public void MergeSlides(string presentationFolder, string sourcePresentation, string destPresentation, int id, int Index)
        {
            int Idx = 0;

            // Open the destination presentation.
            using (PresentationDocument myDestDeck = PresentationDocument.Open(presentationFolder + destPresentation, true))
            {
                PresentationPart destPresPart = myDestDeck.PresentationPart;

                // If the merged presentation does not have a SlideIdList
                // element yet, add it.
                if (destPresPart.Presentation.SlideIdList == null)
                {
                    destPresPart.Presentation.SlideIdList = new SlideIdList();
                }

                // Open the source presentation. This will throw an exception if
                // the source presentation does not exist.
                using (PresentationDocument mySourceDeck = PresentationDocument.Open(presentationFolder + sourcePresentation, false))
                {
                    PresentationPart sourcePresPart = mySourceDeck.PresentationPart;

                    // Get unique ids for the slide master and slide lists for use later.
                    uniqueId = GetMaxSlideMasterId(destPresPart.Presentation.SlideMasterIdList);
                    uint maxSlideId = GetMaxSlideId(destPresPart.Presentation.SlideIdList);

                    // Copy each slide in the source presentation, in order, to the destination presentation.
                    foreach (SlideId slideId in sourcePresPart.Presentation.SlideIdList)
                    {
                        if (Idx++ == Index)
                        {
                            SlidePart       sp;
                            SlidePart       destSp;
                            SlideMasterPart destMasterPart;
                            string          relId;
                            SlideMasterId   newSlideMasterId;
                            SlideId         newSlideId;

                            // Create a unique relationship id.
                            id++;
                            sp    = (SlidePart)sourcePresPart.GetPartById(slideId.RelationshipId);
                            relId = sourcePresentation.Remove(sourcePresentation.IndexOf('.')) + id;

                            // Add the slide part to the destination presentation.
                            destSp = destPresPart.AddPart <SlidePart>(sp, relId);

                            // The slide master part was added. Make sure the
                            // relationship between the main presentation part and
                            // the slide master part is in place.
                            destMasterPart = destSp.SlideLayoutPart.SlideMasterPart;
                            destPresPart.AddPart(destMasterPart);

                            // Add the slide master id to the slide master id list.
                            uniqueId++;
                            newSlideMasterId = new SlideMasterId();
                            newSlideMasterId.RelationshipId = destPresPart.GetIdOfPart(destMasterPart);
                            newSlideMasterId.Id             = uniqueId;

                            destPresPart.Presentation.SlideMasterIdList.Append(newSlideMasterId);

                            // Add the slide id to the slide id list.
                            maxSlideId++;
                            newSlideId = new SlideId();
                            newSlideId.RelationshipId = relId;
                            newSlideId.Id             = maxSlideId;

                            destPresPart.Presentation.SlideIdList.Append(newSlideId);
                        }
                    }

                    // Make sure that all slide layout ids are unique.
                    FixSlideLayoutIds(destPresPart);
                }

                // Save the changes to the destination deck.
                destPresPart.Presentation.Save();
            }
        }
        public static void GeneratePresentationPart1Content(PresentationPart presentationPart1)
        {
            Presentation presentation1 = new Presentation()
            {
                ShowSpecialPlaceholderOnTitleSlide = false, RemovePersonalInfoOnSave = true, StrictFirstAndLastChars = false, SaveSubsetFonts = true
            };

            presentation1.AddNamespaceDeclaration("a", "http://schemas.openxmlformats.org/drawingml/2006/main");
            presentation1.AddNamespaceDeclaration("r", "http://schemas.openxmlformats.org/officeDocument/2006/relationships");
            presentation1.AddNamespaceDeclaration("p", "http://schemas.openxmlformats.org/presentationml/2006/main");

            SlideMasterIdList slideMasterIdList1 = new SlideMasterIdList();
            SlideMasterId     slideMasterId1     = new SlideMasterId()
            {
                Id = (UInt32Value)2147483648U, RelationshipId = "rId4"
            };

            slideMasterIdList1.Append(slideMasterId1);

            NotesMasterIdList notesMasterIdList1 = new NotesMasterIdList();
            NotesMasterId     notesMasterId1     = new NotesMasterId()
            {
                Id = "rId6"
            };

            notesMasterIdList1.Append(notesMasterId1);

            HandoutMasterIdList handoutMasterIdList1 = new HandoutMasterIdList();
            HandoutMasterId     handoutMasterId1     = new HandoutMasterId()
            {
                Id = "rId7"
            };

            handoutMasterIdList1.Append(handoutMasterId1);

            SlideIdList slideIdList1 = new SlideIdList();
            SlideId     slideId1     = new SlideId()
            {
                Id = (UInt32Value)371U, RelationshipId = "rId5"
            };

            slideIdList1.Append(slideId1);
            SlideSize slideSize1 = new SlideSize()
            {
                Cx = 9906000, Cy = 6858000, Type = SlideSizeValues.A4
            };
            NotesSize notesSize1 = new NotesSize()
            {
                Cx = 6797675L, Cy = 9874250L
            };

            DefaultTextStyle defaultTextStyle1 = new DefaultTextStyle();

            A.DefaultParagraphProperties defaultParagraphProperties1 = new A.DefaultParagraphProperties();
            A.DefaultRunProperties       defaultRunProperties1       = new A.DefaultRunProperties()
            {
                Language = "en-US"
            };

            defaultParagraphProperties1.Append(defaultRunProperties1);

            A.Level1ParagraphProperties level1ParagraphProperties1 = new A.Level1ParagraphProperties()
            {
                Alignment = A.TextAlignmentTypeValues.Left, RightToLeft = false, EastAsianLineBreak = false, FontAlignment = A.TextFontAlignmentValues.Baseline, Height = false
            };

            A.SpaceBefore    spaceBefore1    = new A.SpaceBefore();
            A.SpacingPercent spacingPercent1 = new A.SpacingPercent()
            {
                Val = 0
            };

            spaceBefore1.Append(spacingPercent1);

            A.SpaceAfter     spaceAfter1     = new A.SpaceAfter();
            A.SpacingPercent spacingPercent2 = new A.SpacingPercent()
            {
                Val = 0
            };

            spaceAfter1.Append(spacingPercent2);

            A.DefaultRunProperties defaultRunProperties2 = new A.DefaultRunProperties()
            {
                FontSize = 2400, Kerning = 1200
            };

            A.SolidFill   solidFill1   = new A.SolidFill();
            A.SchemeColor schemeColor1 = new A.SchemeColor()
            {
                Val = A.SchemeColorValues.Text1
            };

            solidFill1.Append(schemeColor1);
            A.LatinFont latinFont1 = new A.LatinFont()
            {
                Typeface = "Arial", Panose = "020B0604020202020204", PitchFamily = 34, CharacterSet = 0
            };
            A.EastAsianFont eastAsianFont1 = new A.EastAsianFont()
            {
                Typeface = "MS PGothic", Panose = "020B0600070205080204", PitchFamily = 34, CharacterSet = -128
            };
            A.ComplexScriptFont complexScriptFont1 = new A.ComplexScriptFont()
            {
                Typeface = "+mn-cs"
            };

            defaultRunProperties2.Append(solidFill1);
            defaultRunProperties2.Append(latinFont1);
            defaultRunProperties2.Append(eastAsianFont1);
            defaultRunProperties2.Append(complexScriptFont1);

            level1ParagraphProperties1.Append(spaceBefore1);
            level1ParagraphProperties1.Append(spaceAfter1);
            level1ParagraphProperties1.Append(defaultRunProperties2);

            A.Level2ParagraphProperties level2ParagraphProperties1 = new A.Level2ParagraphProperties()
            {
                LeftMargin = 457200, Alignment = A.TextAlignmentTypeValues.Left, RightToLeft = false, EastAsianLineBreak = false, FontAlignment = A.TextFontAlignmentValues.Baseline, Height = false
            };

            A.SpaceBefore    spaceBefore2    = new A.SpaceBefore();
            A.SpacingPercent spacingPercent3 = new A.SpacingPercent()
            {
                Val = 0
            };

            spaceBefore2.Append(spacingPercent3);

            A.SpaceAfter     spaceAfter2     = new A.SpaceAfter();
            A.SpacingPercent spacingPercent4 = new A.SpacingPercent()
            {
                Val = 0
            };

            spaceAfter2.Append(spacingPercent4);

            A.DefaultRunProperties defaultRunProperties3 = new A.DefaultRunProperties()
            {
                FontSize = 2400, Kerning = 1200
            };

            A.SolidFill   solidFill2   = new A.SolidFill();
            A.SchemeColor schemeColor2 = new A.SchemeColor()
            {
                Val = A.SchemeColorValues.Text1
            };

            solidFill2.Append(schemeColor2);
            A.LatinFont latinFont2 = new A.LatinFont()
            {
                Typeface = "Arial", Panose = "020B0604020202020204", PitchFamily = 34, CharacterSet = 0
            };
            A.EastAsianFont eastAsianFont2 = new A.EastAsianFont()
            {
                Typeface = "MS PGothic", Panose = "020B0600070205080204", PitchFamily = 34, CharacterSet = -128
            };
            A.ComplexScriptFont complexScriptFont2 = new A.ComplexScriptFont()
            {
                Typeface = "+mn-cs"
            };

            defaultRunProperties3.Append(solidFill2);
            defaultRunProperties3.Append(latinFont2);
            defaultRunProperties3.Append(eastAsianFont2);
            defaultRunProperties3.Append(complexScriptFont2);

            level2ParagraphProperties1.Append(spaceBefore2);
            level2ParagraphProperties1.Append(spaceAfter2);
            level2ParagraphProperties1.Append(defaultRunProperties3);

            A.Level3ParagraphProperties level3ParagraphProperties1 = new A.Level3ParagraphProperties()
            {
                LeftMargin = 914400, Alignment = A.TextAlignmentTypeValues.Left, RightToLeft = false, EastAsianLineBreak = false, FontAlignment = A.TextFontAlignmentValues.Baseline, Height = false
            };

            A.SpaceBefore    spaceBefore3    = new A.SpaceBefore();
            A.SpacingPercent spacingPercent5 = new A.SpacingPercent()
            {
                Val = 0
            };

            spaceBefore3.Append(spacingPercent5);

            A.SpaceAfter     spaceAfter3     = new A.SpaceAfter();
            A.SpacingPercent spacingPercent6 = new A.SpacingPercent()
            {
                Val = 0
            };

            spaceAfter3.Append(spacingPercent6);

            A.DefaultRunProperties defaultRunProperties4 = new A.DefaultRunProperties()
            {
                FontSize = 2400, Kerning = 1200
            };

            A.SolidFill   solidFill3   = new A.SolidFill();
            A.SchemeColor schemeColor3 = new A.SchemeColor()
            {
                Val = A.SchemeColorValues.Text1
            };

            solidFill3.Append(schemeColor3);
            A.LatinFont latinFont3 = new A.LatinFont()
            {
                Typeface = "Arial", Panose = "020B0604020202020204", PitchFamily = 34, CharacterSet = 0
            };
            A.EastAsianFont eastAsianFont3 = new A.EastAsianFont()
            {
                Typeface = "MS PGothic", Panose = "020B0600070205080204", PitchFamily = 34, CharacterSet = -128
            };
            A.ComplexScriptFont complexScriptFont3 = new A.ComplexScriptFont()
            {
                Typeface = "+mn-cs"
            };

            defaultRunProperties4.Append(solidFill3);
            defaultRunProperties4.Append(latinFont3);
            defaultRunProperties4.Append(eastAsianFont3);
            defaultRunProperties4.Append(complexScriptFont3);

            level3ParagraphProperties1.Append(spaceBefore3);
            level3ParagraphProperties1.Append(spaceAfter3);
            level3ParagraphProperties1.Append(defaultRunProperties4);

            A.Level4ParagraphProperties level4ParagraphProperties1 = new A.Level4ParagraphProperties()
            {
                LeftMargin = 1371600, Alignment = A.TextAlignmentTypeValues.Left, RightToLeft = false, EastAsianLineBreak = false, FontAlignment = A.TextFontAlignmentValues.Baseline, Height = false
            };

            A.SpaceBefore    spaceBefore4    = new A.SpaceBefore();
            A.SpacingPercent spacingPercent7 = new A.SpacingPercent()
            {
                Val = 0
            };

            spaceBefore4.Append(spacingPercent7);

            A.SpaceAfter     spaceAfter4     = new A.SpaceAfter();
            A.SpacingPercent spacingPercent8 = new A.SpacingPercent()
            {
                Val = 0
            };

            spaceAfter4.Append(spacingPercent8);

            A.DefaultRunProperties defaultRunProperties5 = new A.DefaultRunProperties()
            {
                FontSize = 2400, Kerning = 1200
            };

            A.SolidFill   solidFill4   = new A.SolidFill();
            A.SchemeColor schemeColor4 = new A.SchemeColor()
            {
                Val = A.SchemeColorValues.Text1
            };

            solidFill4.Append(schemeColor4);
            A.LatinFont latinFont4 = new A.LatinFont()
            {
                Typeface = "Arial", Panose = "020B0604020202020204", PitchFamily = 34, CharacterSet = 0
            };
            A.EastAsianFont eastAsianFont4 = new A.EastAsianFont()
            {
                Typeface = "MS PGothic", Panose = "020B0600070205080204", PitchFamily = 34, CharacterSet = -128
            };
            A.ComplexScriptFont complexScriptFont4 = new A.ComplexScriptFont()
            {
                Typeface = "+mn-cs"
            };

            defaultRunProperties5.Append(solidFill4);
            defaultRunProperties5.Append(latinFont4);
            defaultRunProperties5.Append(eastAsianFont4);
            defaultRunProperties5.Append(complexScriptFont4);

            level4ParagraphProperties1.Append(spaceBefore4);
            level4ParagraphProperties1.Append(spaceAfter4);
            level4ParagraphProperties1.Append(defaultRunProperties5);

            A.Level5ParagraphProperties level5ParagraphProperties1 = new A.Level5ParagraphProperties()
            {
                LeftMargin = 1828800, Alignment = A.TextAlignmentTypeValues.Left, RightToLeft = false, EastAsianLineBreak = false, FontAlignment = A.TextFontAlignmentValues.Baseline, Height = false
            };

            A.SpaceBefore    spaceBefore5    = new A.SpaceBefore();
            A.SpacingPercent spacingPercent9 = new A.SpacingPercent()
            {
                Val = 0
            };

            spaceBefore5.Append(spacingPercent9);

            A.SpaceAfter     spaceAfter5      = new A.SpaceAfter();
            A.SpacingPercent spacingPercent10 = new A.SpacingPercent()
            {
                Val = 0
            };

            spaceAfter5.Append(spacingPercent10);

            A.DefaultRunProperties defaultRunProperties6 = new A.DefaultRunProperties()
            {
                FontSize = 2400, Kerning = 1200
            };

            A.SolidFill   solidFill5   = new A.SolidFill();
            A.SchemeColor schemeColor5 = new A.SchemeColor()
            {
                Val = A.SchemeColorValues.Text1
            };

            solidFill5.Append(schemeColor5);
            A.LatinFont latinFont5 = new A.LatinFont()
            {
                Typeface = "Arial", Panose = "020B0604020202020204", PitchFamily = 34, CharacterSet = 0
            };
            A.EastAsianFont eastAsianFont5 = new A.EastAsianFont()
            {
                Typeface = "MS PGothic", Panose = "020B0600070205080204", PitchFamily = 34, CharacterSet = -128
            };
            A.ComplexScriptFont complexScriptFont5 = new A.ComplexScriptFont()
            {
                Typeface = "+mn-cs"
            };

            defaultRunProperties6.Append(solidFill5);
            defaultRunProperties6.Append(latinFont5);
            defaultRunProperties6.Append(eastAsianFont5);
            defaultRunProperties6.Append(complexScriptFont5);

            level5ParagraphProperties1.Append(spaceBefore5);
            level5ParagraphProperties1.Append(spaceAfter5);
            level5ParagraphProperties1.Append(defaultRunProperties6);

            A.Level6ParagraphProperties level6ParagraphProperties1 = new A.Level6ParagraphProperties()
            {
                LeftMargin = 2286000, Alignment = A.TextAlignmentTypeValues.Left, DefaultTabSize = 914400, RightToLeft = false, EastAsianLineBreak = true, LatinLineBreak = false, Height = true
            };

            A.DefaultRunProperties defaultRunProperties7 = new A.DefaultRunProperties()
            {
                FontSize = 2400, Kerning = 1200
            };

            A.SolidFill   solidFill6   = new A.SolidFill();
            A.SchemeColor schemeColor6 = new A.SchemeColor()
            {
                Val = A.SchemeColorValues.Text1
            };

            solidFill6.Append(schemeColor6);
            A.LatinFont latinFont6 = new A.LatinFont()
            {
                Typeface = "Arial", Panose = "020B0604020202020204", PitchFamily = 34, CharacterSet = 0
            };
            A.EastAsianFont eastAsianFont6 = new A.EastAsianFont()
            {
                Typeface = "MS PGothic", Panose = "020B0600070205080204", PitchFamily = 34, CharacterSet = -128
            };
            A.ComplexScriptFont complexScriptFont6 = new A.ComplexScriptFont()
            {
                Typeface = "+mn-cs"
            };

            defaultRunProperties7.Append(solidFill6);
            defaultRunProperties7.Append(latinFont6);
            defaultRunProperties7.Append(eastAsianFont6);
            defaultRunProperties7.Append(complexScriptFont6);

            level6ParagraphProperties1.Append(defaultRunProperties7);

            A.Level7ParagraphProperties level7ParagraphProperties1 = new A.Level7ParagraphProperties()
            {
                LeftMargin = 2743200, Alignment = A.TextAlignmentTypeValues.Left, DefaultTabSize = 914400, RightToLeft = false, EastAsianLineBreak = true, LatinLineBreak = false, Height = true
            };

            A.DefaultRunProperties defaultRunProperties8 = new A.DefaultRunProperties()
            {
                FontSize = 2400, Kerning = 1200
            };

            A.SolidFill   solidFill7   = new A.SolidFill();
            A.SchemeColor schemeColor7 = new A.SchemeColor()
            {
                Val = A.SchemeColorValues.Text1
            };

            solidFill7.Append(schemeColor7);
            A.LatinFont latinFont7 = new A.LatinFont()
            {
                Typeface = "Arial", Panose = "020B0604020202020204", PitchFamily = 34, CharacterSet = 0
            };
            A.EastAsianFont eastAsianFont7 = new A.EastAsianFont()
            {
                Typeface = "MS PGothic", Panose = "020B0600070205080204", PitchFamily = 34, CharacterSet = -128
            };
            A.ComplexScriptFont complexScriptFont7 = new A.ComplexScriptFont()
            {
                Typeface = "+mn-cs"
            };

            defaultRunProperties8.Append(solidFill7);
            defaultRunProperties8.Append(latinFont7);
            defaultRunProperties8.Append(eastAsianFont7);
            defaultRunProperties8.Append(complexScriptFont7);

            level7ParagraphProperties1.Append(defaultRunProperties8);

            A.Level8ParagraphProperties level8ParagraphProperties1 = new A.Level8ParagraphProperties()
            {
                LeftMargin = 3200400, Alignment = A.TextAlignmentTypeValues.Left, DefaultTabSize = 914400, RightToLeft = false, EastAsianLineBreak = true, LatinLineBreak = false, Height = true
            };

            A.DefaultRunProperties defaultRunProperties9 = new A.DefaultRunProperties()
            {
                FontSize = 2400, Kerning = 1200
            };

            A.SolidFill   solidFill8   = new A.SolidFill();
            A.SchemeColor schemeColor8 = new A.SchemeColor()
            {
                Val = A.SchemeColorValues.Text1
            };

            solidFill8.Append(schemeColor8);
            A.LatinFont latinFont8 = new A.LatinFont()
            {
                Typeface = "Arial", Panose = "020B0604020202020204", PitchFamily = 34, CharacterSet = 0
            };
            A.EastAsianFont eastAsianFont8 = new A.EastAsianFont()
            {
                Typeface = "MS PGothic", Panose = "020B0600070205080204", PitchFamily = 34, CharacterSet = -128
            };
            A.ComplexScriptFont complexScriptFont8 = new A.ComplexScriptFont()
            {
                Typeface = "+mn-cs"
            };

            defaultRunProperties9.Append(solidFill8);
            defaultRunProperties9.Append(latinFont8);
            defaultRunProperties9.Append(eastAsianFont8);
            defaultRunProperties9.Append(complexScriptFont8);

            level8ParagraphProperties1.Append(defaultRunProperties9);

            A.Level9ParagraphProperties level9ParagraphProperties1 = new A.Level9ParagraphProperties()
            {
                LeftMargin = 3657600, Alignment = A.TextAlignmentTypeValues.Left, DefaultTabSize = 914400, RightToLeft = false, EastAsianLineBreak = true, LatinLineBreak = false, Height = true
            };

            A.DefaultRunProperties defaultRunProperties10 = new A.DefaultRunProperties()
            {
                FontSize = 2400, Kerning = 1200
            };

            A.SolidFill   solidFill9   = new A.SolidFill();
            A.SchemeColor schemeColor9 = new A.SchemeColor()
            {
                Val = A.SchemeColorValues.Text1
            };

            solidFill9.Append(schemeColor9);
            A.LatinFont latinFont9 = new A.LatinFont()
            {
                Typeface = "Arial", Panose = "020B0604020202020204", PitchFamily = 34, CharacterSet = 0
            };
            A.EastAsianFont eastAsianFont9 = new A.EastAsianFont()
            {
                Typeface = "MS PGothic", Panose = "020B0600070205080204", PitchFamily = 34, CharacterSet = -128
            };
            A.ComplexScriptFont complexScriptFont9 = new A.ComplexScriptFont()
            {
                Typeface = "+mn-cs"
            };

            defaultRunProperties10.Append(solidFill9);
            defaultRunProperties10.Append(latinFont9);
            defaultRunProperties10.Append(eastAsianFont9);
            defaultRunProperties10.Append(complexScriptFont9);

            level9ParagraphProperties1.Append(defaultRunProperties10);

            defaultTextStyle1.Append(defaultParagraphProperties1);
            defaultTextStyle1.Append(level1ParagraphProperties1);
            defaultTextStyle1.Append(level2ParagraphProperties1);
            defaultTextStyle1.Append(level3ParagraphProperties1);
            defaultTextStyle1.Append(level4ParagraphProperties1);
            defaultTextStyle1.Append(level5ParagraphProperties1);
            defaultTextStyle1.Append(level6ParagraphProperties1);
            defaultTextStyle1.Append(level7ParagraphProperties1);
            defaultTextStyle1.Append(level8ParagraphProperties1);
            defaultTextStyle1.Append(level9ParagraphProperties1);

            PresentationExtensionList presentationExtensionList1 = new PresentationExtensionList();

            PresentationExtension presentationExtension1 = new PresentationExtension()
            {
                Uri = "{EFAFB233-063F-42B5-8137-9DF3F51BA10A}"
            };

            P15.SlideGuideList slideGuideList1 = new P15.SlideGuideList();
            slideGuideList1.AddNamespaceDeclaration("p15", "http://schemas.microsoft.com/office/powerpoint/2012/main");

            P15.ExtendedGuide extendedGuide1 = new P15.ExtendedGuide()
            {
                Id = (UInt32Value)1U, Orientation = DirectionValues.Horizontal, Position = 240
            };

            P15.ColorType      colorType1        = new P15.ColorType();
            A.RgbColorModelHex rgbColorModelHex1 = new A.RgbColorModelHex()
            {
                Val = "A4A3A4"
            };

            colorType1.Append(rgbColorModelHex1);

            extendedGuide1.Append(colorType1);

            P15.ExtendedGuide extendedGuide2 = new P15.ExtendedGuide()
            {
                Id = (UInt32Value)2U, Orientation = DirectionValues.Horizontal, Position = 3648, IsUserDrawn = true
            };

            P15.ColorType      colorType2        = new P15.ColorType();
            A.RgbColorModelHex rgbColorModelHex2 = new A.RgbColorModelHex()
            {
                Val = "A4A3A4"
            };

            colorType2.Append(rgbColorModelHex2);

            extendedGuide2.Append(colorType2);

            P15.ExtendedGuide extendedGuide3 = new P15.ExtendedGuide()
            {
                Id = (UInt32Value)4U, Position = 2736, IsUserDrawn = true
            };

            P15.ColorType      colorType3        = new P15.ColorType();
            A.RgbColorModelHex rgbColorModelHex3 = new A.RgbColorModelHex()
            {
                Val = "A4A3A4"
            };

            colorType3.Append(rgbColorModelHex3);

            extendedGuide3.Append(colorType3);

            P15.ExtendedGuide extendedGuide4 = new P15.ExtendedGuide()
            {
                Id = (UInt32Value)5U, Position = 5904
            };

            P15.ColorType      colorType4        = new P15.ColorType();
            A.RgbColorModelHex rgbColorModelHex4 = new A.RgbColorModelHex()
            {
                Val = "A4A3A4"
            };

            colorType4.Append(rgbColorModelHex4);

            extendedGuide4.Append(colorType4);

            P15.ExtendedGuide extendedGuide5 = new P15.ExtendedGuide()
            {
                Id = (UInt32Value)6U, Position = 336
            };

            P15.ColorType      colorType5        = new P15.ColorType();
            A.RgbColorModelHex rgbColorModelHex5 = new A.RgbColorModelHex()
            {
                Val = "A4A3A4"
            };

            colorType5.Append(rgbColorModelHex5);

            extendedGuide5.Append(colorType5);

            P15.ExtendedGuide extendedGuide6 = new P15.ExtendedGuide()
            {
                Id = (UInt32Value)7U, Orientation = DirectionValues.Horizontal, IsUserDrawn = true
            };

            P15.ColorType      colorType6        = new P15.ColorType();
            A.RgbColorModelHex rgbColorModelHex6 = new A.RgbColorModelHex()
            {
                Val = "A4A3A4"
            };

            colorType6.Append(rgbColorModelHex6);

            extendedGuide6.Append(colorType6);

            P15.ExtendedGuide extendedGuide7 = new P15.ExtendedGuide()
            {
                Id = (UInt32Value)8U, Orientation = DirectionValues.Horizontal, Position = 1152, IsUserDrawn = true
            };

            P15.ColorType      colorType7        = new P15.ColorType();
            A.RgbColorModelHex rgbColorModelHex7 = new A.RgbColorModelHex()
            {
                Val = "A4A3A4"
            };

            colorType7.Append(rgbColorModelHex7);

            extendedGuide7.Append(colorType7);

            P15.ExtendedGuide extendedGuide8 = new P15.ExtendedGuide()
            {
                Id = (UInt32Value)9U, Orientation = DirectionValues.Horizontal, Position = 1200, IsUserDrawn = true
            };

            P15.ColorType      colorType8        = new P15.ColorType();
            A.RgbColorModelHex rgbColorModelHex8 = new A.RgbColorModelHex()
            {
                Val = "A4A3A4"
            };

            colorType8.Append(rgbColorModelHex8);

            extendedGuide8.Append(colorType8);

            P15.ExtendedGuide extendedGuide9 = new P15.ExtendedGuide()
            {
                Id = (UInt32Value)10U, Position = 2784, IsUserDrawn = true
            };

            P15.ColorType      colorType9        = new P15.ColorType();
            A.RgbColorModelHex rgbColorModelHex9 = new A.RgbColorModelHex()
            {
                Val = "A4A3A4"
            };

            colorType9.Append(rgbColorModelHex9);

            extendedGuide9.Append(colorType9);

            P15.ExtendedGuide extendedGuide10 = new P15.ExtendedGuide()
            {
                Id = (UInt32Value)12U, Orientation = DirectionValues.Horizontal, Position = 2448, IsUserDrawn = true
            };

            P15.ColorType      colorType10        = new P15.ColorType();
            A.RgbColorModelHex rgbColorModelHex10 = new A.RgbColorModelHex()
            {
                Val = "A4A3A4"
            };

            colorType10.Append(rgbColorModelHex10);

            extendedGuide10.Append(colorType10);

            P15.ExtendedGuide extendedGuide11 = new P15.ExtendedGuide()
            {
                Id = (UInt32Value)13U, Orientation = DirectionValues.Horizontal, Position = 2496, IsUserDrawn = true
            };

            P15.ColorType      colorType11        = new P15.ColorType();
            A.RgbColorModelHex rgbColorModelHex11 = new A.RgbColorModelHex()
            {
                Val = "A4A3A4"
            };

            colorType11.Append(rgbColorModelHex11);

            extendedGuide11.Append(colorType11);

            P15.ExtendedGuide extendedGuide12 = new P15.ExtendedGuide()
            {
                Id = (UInt32Value)14U, Position = 1872, IsUserDrawn = true
            };

            P15.ColorType      colorType12        = new P15.ColorType();
            A.RgbColorModelHex rgbColorModelHex12 = new A.RgbColorModelHex()
            {
                Val = "A4A3A4"
            };

            colorType12.Append(rgbColorModelHex12);

            extendedGuide12.Append(colorType12);

            P15.ExtendedGuide extendedGuide13 = new P15.ExtendedGuide()
            {
                Id = (UInt32Value)15U, Position = 2688, IsUserDrawn = true
            };

            P15.ColorType      colorType13        = new P15.ColorType();
            A.RgbColorModelHex rgbColorModelHex13 = new A.RgbColorModelHex()
            {
                Val = "A4A3A4"
            };

            colorType13.Append(rgbColorModelHex13);

            extendedGuide13.Append(colorType13);

            P15.ExtendedGuide extendedGuide14 = new P15.ExtendedGuide()
            {
                Id = (UInt32Value)16U, Orientation = DirectionValues.Horizontal, Position = 288, IsUserDrawn = true
            };

            P15.ColorType      colorType14        = new P15.ColorType();
            A.RgbColorModelHex rgbColorModelHex14 = new A.RgbColorModelHex()
            {
                Val = "A4A3A4"
            };

            colorType14.Append(rgbColorModelHex14);

            extendedGuide14.Append(colorType14);

            P15.ExtendedGuide extendedGuide15 = new P15.ExtendedGuide()
            {
                Id = (UInt32Value)17U, Orientation = DirectionValues.Horizontal, Position = 1104, IsUserDrawn = true
            };

            P15.ColorType      colorType15        = new P15.ColorType();
            A.RgbColorModelHex rgbColorModelHex15 = new A.RgbColorModelHex()
            {
                Val = "A4A3A4"
            };

            colorType15.Append(rgbColorModelHex15);

            extendedGuide15.Append(colorType15);

            slideGuideList1.Append(extendedGuide1);
            slideGuideList1.Append(extendedGuide2);
            slideGuideList1.Append(extendedGuide3);
            slideGuideList1.Append(extendedGuide4);
            slideGuideList1.Append(extendedGuide5);
            slideGuideList1.Append(extendedGuide6);
            slideGuideList1.Append(extendedGuide7);
            slideGuideList1.Append(extendedGuide8);
            slideGuideList1.Append(extendedGuide9);
            slideGuideList1.Append(extendedGuide10);
            slideGuideList1.Append(extendedGuide11);
            slideGuideList1.Append(extendedGuide12);
            slideGuideList1.Append(extendedGuide13);
            slideGuideList1.Append(extendedGuide14);
            slideGuideList1.Append(extendedGuide15);

            presentationExtension1.Append(slideGuideList1);

            PresentationExtension presentationExtension2 = new PresentationExtension()
            {
                Uri = "{2D200454-40CA-4A62-9FC3-DE9A4176ACB9}"
            };

            P15.NotesGuideList notesGuideList1 = new P15.NotesGuideList();
            notesGuideList1.AddNamespaceDeclaration("p15", "http://schemas.microsoft.com/office/powerpoint/2012/main");

            P15.ExtendedGuide extendedGuide16 = new P15.ExtendedGuide()
            {
                Id = (UInt32Value)1U, Orientation = DirectionValues.Horizontal, Position = 3110, IsUserDrawn = true
            };

            P15.ColorType      colorType16        = new P15.ColorType();
            A.RgbColorModelHex rgbColorModelHex16 = new A.RgbColorModelHex()
            {
                Val = "A4A3A4"
            };

            colorType16.Append(rgbColorModelHex16);

            extendedGuide16.Append(colorType16);

            P15.ExtendedGuide extendedGuide17 = new P15.ExtendedGuide()
            {
                Id = (UInt32Value)2U, Position = 2140, IsUserDrawn = true
            };

            P15.ColorType      colorType17        = new P15.ColorType();
            A.RgbColorModelHex rgbColorModelHex17 = new A.RgbColorModelHex()
            {
                Val = "A4A3A4"
            };

            colorType17.Append(rgbColorModelHex17);

            extendedGuide17.Append(colorType17);

            notesGuideList1.Append(extendedGuide16);
            notesGuideList1.Append(extendedGuide17);

            presentationExtension2.Append(notesGuideList1);

            presentationExtensionList1.Append(presentationExtension1);
            presentationExtensionList1.Append(presentationExtension2);

            presentation1.Append(slideMasterIdList1);
            presentation1.Append(notesMasterIdList1);
            presentation1.Append(handoutMasterIdList1);
            presentation1.Append(slideIdList1);
            presentation1.Append(slideSize1);
            presentation1.Append(notesSize1);
            presentation1.Append(defaultTextStyle1);
            presentation1.Append(presentationExtensionList1);

            presentationPart1.Presentation = presentation1;
        }
Exemplo n.º 6
0
        // Delete the specified slide from the presentation.
        public void DeleteSlide(PresentationDocument presentationDocument, int slideIndex)
        {
            if (presentationDocument == null)
            {
                throw new ArgumentNullException("presentationDocument");
            }

            // Use the CountSlides sample to get the number of slides in the presentation.
            int slidesCount = CountSlides(presentationDocument);

            if (slideIndex < 0 || slideIndex >= slidesCount)
            {
                throw new ArgumentOutOfRangeException("slideIndex");
            }

            // Get the presentation part from the presentation document.
            PresentationPart presentationPart = presentationDocument.PresentationPart;

            // Get the presentation from the presentation part.
            Presentation presentation = presentationPart.Presentation;

            // Get the list of slide IDs in the presentation.
            SlideIdList slideIdList = presentation.SlideIdList;

            // Get the slide ID of the specified slide
            SlideId slideId = slideIdList.ChildElements[slideIndex] as SlideId;

            // Get the relationship ID of the slide.
            string slideRelId = slideId.RelationshipId;

            // Remove the slide from the slide list.
            slideIdList.RemoveChild(slideId);

            // Remove references to the slide from all custom shows.
            if (presentation.CustomShowList != null)
            {
                // Iterate through the list of custom shows.
                foreach (var customShow in presentation.CustomShowList.Elements <CustomShow>())
                {
                    if (customShow.SlideList != null)
                    {
                        // Declare a link list of slide list entries.
                        System.Collections.Generic.LinkedList <SlideListEntry> slideListEntries = new System.Collections.Generic.LinkedList <SlideListEntry>();
                        foreach (SlideListEntry slideListEntry in customShow.SlideList.Elements())
                        {
                            // Find the slide reference to remove from the custom show.
                            if (slideListEntry.Id != null && slideListEntry.Id == slideRelId)
                            {
                                slideListEntries.AddLast(slideListEntry);
                            }
                        }

                        // Remove all references to the slide from the custom show.
                        foreach (SlideListEntry slideListEntry in slideListEntries)
                        {
                            customShow.SlideList.RemoveChild(slideListEntry);
                        }
                    }
                }
            }

            // Save the modified presentation.
            presentation.Save();

            // Get the slide part for the specified slide.
            SlidePart slidePart = presentationPart.GetPartById(slideRelId) as SlidePart;

            // Remove the slide part.
            presentationPart.DeletePart(slidePart);
        }
Exemplo n.º 7
0
        private void MergeSlides(PresentationInfo sourcePresentation, string destPresentation, ref Dictionary <int, int> reOrderPair, ref int val, out int reOrderConstantValue)
        {
            using (PresentationDocument destinationPresentationDoc = PresentationDocument.Open(destPresentation, true))
            {
                PresentationPart destPresPart = destinationPresentationDoc.PresentationPart;

                // If the merged presentation doesn't have a SlideIdList element yet then add it.
                if (destPresPart.Presentation.SlideIdList == null)
                {
                    destPresPart.Presentation.SlideIdList = new SlideIdList();
                }

                string sourceFileName = GetFileNameWithExtension(sourcePresentation.File);

                // Open the source presentation. This will throw an exception if the source presentation does not exist.
                using (PresentationDocument sourcePresentationDoc = PresentationDocument.Open(sourceFileName, false))
                {
                    PresentationPart sourcePresPart = sourcePresentationDoc.PresentationPart;

                    // Get unique ids for the slide master and slide lists for use later.
                    uniqueId = GetMaxSlideMasterId(destPresPart.Presentation.SlideMasterIdList);
                    uint maxSlideId = GetMaxSlideId(destPresPart.Presentation.SlideIdList);

                    reOrderConstantValue = sourcePresPart.Presentation.SlideIdList.Count();

                    // Copy each slide in the source presentation in order to the destination presentation.
                    foreach (SlideId slideId in sourcePresPart.Presentation.SlideIdList)
                    {
                        SlidePart       sp;
                        SlidePart       destSp;
                        SlideMasterPart destMasterPart;
                        string          relId;
                        SlideMasterId   newSlideMasterId;
                        SlideId         newSlideId;

                        //increase the slide count
                        mergedSideCount++;

                        if (sourcePresentation.InsertPosition != -1)
                        {
                            reOrderPair.Add(mergedSideCount - 1, val++);
                        }

                        // Create a unique relationship id.
                        id++;
                        sp    = (SlidePart)sourcePresPart.GetPartById(slideId.RelationshipId);
                        relId = "uniq" + id;

                        // Add the slide part to the destination presentation.
                        destSp = destPresPart.AddPart <SlidePart>(sp, relId);

                        // The master part was added. Make sure the relationship is in place.
                        destMasterPart = destSp.SlideLayoutPart.SlideMasterPart;
                        destPresPart.AddPart(destMasterPart);

                        // Add slide master to slide master list.
                        uniqueId++;
                        newSlideMasterId = new SlideMasterId();
                        newSlideMasterId.RelationshipId = destPresPart.GetIdOfPart(destMasterPart);
                        newSlideMasterId.Id             = uniqueId;

                        // Add slide to slide list.
                        maxSlideId++;
                        newSlideId = new SlideId();
                        newSlideId.RelationshipId = relId;
                        newSlideId.Id             = maxSlideId;

                        destPresPart.Presentation.SlideMasterIdList.Append(newSlideMasterId);
                        destPresPart.Presentation.SlideIdList.Append(newSlideId);
                    }

                    // Make sure all slide ids are unique.
                    ModifySlideLayoutIds(destPresPart);
                }

                // Save the changes to the destination presentation.
                destPresPart.Presentation.Save();
            }
        }
Exemplo n.º 8
0
    public static void DeleteSlide(string presentationFile)
    {
        if (presentationFile == null)
        {
            throw new ArgumentNullException("presentationDocument");
        }

        using (PresentationDocument presentationDocument = PresentationDocument.Open(presentationFile, true))
        {
            // Get the presentation part from the presentation document.
            PresentationPart presentationPart = presentationDocument.PresentationPart;

            // Get the presentation from the presentation part.
            DocumentFormat.OpenXml.Presentation.Presentation presentation = presentationPart.Presentation;

            // Get the list of slide IDs in the presentation.
            SlideIdList slideIdList = presentation.SlideIdList;

            int slideIdx = -1;
            foreach (SlideId _slideId in presentation.SlideIdList)
            {
                slideIdx++;

                // Get the slide ID of the specified slide
                SlideId slideId = slideIdList.ChildElements[slideIdx] as SlideId;

                // Get the relationship ID of the slide.
                string slideRelId = slideId.RelationshipId;

                // Get the slide part for the specified slide.
                SlidePart slidePart = presentationPart.GetPartById(slideRelId) as SlidePart;

                if (slidePart.Slide.Show != null)
                {
                    if (slidePart.Slide.Show.HasValue != null)
                    {
                        // Remove the slide from the slide list.
                        slideIdList.RemoveChild(slideId);

                        // Remove references to the slide from all custom shows.
                        if (presentation.CustomShowList != null)
                        {
                            // Iterate through the list of custom shows.
                            foreach (var customShow in presentation.CustomShowList.Elements <CustomShow>())
                            {
                                if (customShow.SlideList != null)
                                {
                                    // Declare a link list of slide list entries.
                                    LinkedList <SlideListEntry> slideListEntries = new LinkedList <SlideListEntry>();
                                    foreach (SlideListEntry slideListEntry in customShow.SlideList.Elements())
                                    {
                                        // Find the slide reference to remove from the custom show.
                                        if (slideListEntry.Id != null && slideListEntry.Id == slideRelId)
                                        {
                                            slideListEntries.AddLast(slideListEntry);
                                        }
                                    }

                                    // Remove all references to the slide from the custom show.
                                    foreach (SlideListEntry slideListEntry in slideListEntries)
                                    {
                                        customShow.SlideList.RemoveChild(slideListEntry);
                                    }
                                }
                            }
                        }

                        // Save the modified presentation.
                        presentation.Save();

                        // Remove the slide part.
                        presentationPart.DeletePart(slidePart);
                        break;
                    }
                }
            }
        }
    }
Exemplo n.º 9
0
        public PresentationDocument InsertSlidesFromTemplate(PresentationDocument target, PresentationDocument template, IList <string> slideRelationshipIdList)
        {
            if (target == null)
            {
                throw new ArgumentNullException("target");
            }

            if (template == null)
            {
                throw new ArgumentNullException("template");
            }

            uint maxSlideId = 256;

            var slideIdList      = target.PresentationPart.Presentation.SlideIdList;
            var presentationPart = target.PresentationPart;

            //Find the highest slide ID in the current list.
            foreach (SlideId slideId in slideIdList.ChildElements)
            {
                if (slideId.Id.Value > maxSlideId)
                {
                    maxSlideId = slideId.Id;
                }
            }

            presentationPart.Presentation.SlideMasterIdList.RemoveAllChildren();
            uint uniqueId = GetMaxIdFromChild(presentationPart.Presentation.SlideMasterIdList);

            //check what if relationshipids repeat?
            foreach (string slideRelationshipId in slideRelationshipIdList)
            {
                maxSlideId++;
                uniqueId++;

                //Create the slide part and copy the data from the first part
                var       templateSlide       = (SlidePart)template.PresentationPart.GetPartById(slideRelationshipId);
                var       newIdFromTemplateId = string.Format("source{0}", slideRelationshipId);
                SlidePart newSlidePart        = presentationPart.AddPart(templateSlide, newIdFromTemplateId);

                if (newSlidePart.SlideLayoutPart != null)
                {
                    SlideMasterPart destMasterPart = newSlidePart.SlideLayoutPart.SlideMasterPart;
                    presentationPart.AddPart(destMasterPart);

                    SlideMasterId newSlideMasterId = new SlideMasterId();
                    newSlideMasterId.RelationshipId = presentationPart.GetIdOfPart(destMasterPart);
                    newSlideMasterId.Id             = uniqueId;

                    presentationPart.Presentation.SlideMasterIdList.Append(newSlideMasterId);
                }

                //Insert the new slide into the slide list.
                SlideId newSlideId = slideIdList.AppendChild(new SlideId());

                //Set the slide id and relationship id
                newSlideId.Id             = maxSlideId;
                newSlideId.RelationshipId = presentationPart.GetIdOfPart(newSlidePart);
            }

            FixSlideLayoutIds(presentationPart, uniqueId);
            //after adding OPEN XML SDK 3.0 this fix no longer needed but removes validation errors
            //PresentationMLUtil.FixUpPresentationDocument(target);

            target.PresentationPart.Presentation.Save();

            return(target);
        }
        public static int PPTReorderSlides(string fileName, int originalPosition, int newPosition)
        {
            // Assume that no slide moves; return -1.
            int returnValue = -1;

            // Moving to and from same position? Get out now.
            if (newPosition == originalPosition)
            {
                return(returnValue);
            }

            using (PresentationDocument doc = PresentationDocument.Open(fileName, true))
            {
                // Get the presentation part of the document.
                PresentationPart presentationPart = doc.PresentationPart;
                // No presentation part? Something's wrong with the document.
                if (presentationPart == null)
                {
                    throw new ArgumentException("fileName");
                }

                // If you're here, you know that presentationPart exists.
                int slideCount = presentationPart.SlideParts.Count();

                // No slides? Just return -1 indicating that nothing  happened.
                if (slideCount == 0)
                {
                    return(returnValue);
                }

                // There are slides. Calculate real positions.
                int maxPosition = slideCount - 1;

                // Adjust the positions, if necessary.
                CalcPositions(ref originalPosition, ref newPosition, maxPosition);

                // The two positions could have ended up being the same
                // thing. There's nothing to do, in that case. Otherwise,
                // do the work.
                if (newPosition != originalPosition)
                {
                    Presentation presentation = presentationPart.Presentation;
                    SlideIdList  slideIdList  = presentation.SlideIdList;

                    // Get the slide ID of the source and target slides.
                    SlideId sourceSlide =
                        (SlideId)(slideIdList.ChildElements[originalPosition]);
                    SlideId targetSlide =
                        (SlideId)(slideIdList.ChildElements[newPosition]);

                    // Remove the source slide from its parent tree. You can't
                    // move a slide while it's part of an XML node tree.
                    sourceSlide.Remove();

                    if (newPosition > originalPosition)
                    {
                        slideIdList.InsertAfter(sourceSlide, targetSlide);
                    }
                    else
                    {
                        slideIdList.InsertBefore(sourceSlide, targetSlide);
                    }

                    // Set the return value.
                    returnValue = newPosition;

                    // Save the modified presentation.
                    presentation.Save();
                }
            }
            return(returnValue);
        }
Exemplo n.º 11
0
        public ISlide InsertSlide(ISlideLayout slideLayout, int index)
        {
            if (!(slideLayout is IOpenXmlSlideLayout internalSlideLayout))
            {
                throw new ArgumentException();
            }

            Slide slide = new Slide()
            {
                // CommonSlideData = slideLayoutRef.SlideLayoutPart.SlideLayout.CommonSlideData.CloneNode(true) as CommonSlideData
                CommonSlideData = new CommonSlideData()
                {
                    ShapeTree = new ShapeTree()
                    {
                        NonVisualGroupShapeProperties = internalSlideLayout.SlideLayoutPart.SlideLayout.CommonSlideData.ShapeTree.NonVisualGroupShapeProperties.CloneNode(true) as NonVisualGroupShapeProperties,
                        GroupShapeProperties          = internalSlideLayout.SlideLayoutPart.SlideLayout.CommonSlideData.ShapeTree.GroupShapeProperties.CloneNode(true) as GroupShapeProperties
                    }
                }
            };

            slide.CommonSlideData.ShapeTree.Append(
                internalSlideLayout.SlideLayoutPart.SlideLayout.CommonSlideData.ShapeTree
                .Select(element => OpenXmlVisualFactory.TryCreateVisual(internalSlideLayout, element, out IOpenXmlVisual visual) ? visual : null).Where(visual => visual != null)
                .Where(visual => visual?.IsPlaceholder ?? false)
                .Select(visual => visual.CloneForSlide())
                );

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

            slide.Save(slidePart);

            slidePart.CreateRelationshipToPartDefaultId(internalSlideLayout.SlideLayoutPart);

            if (this.presentationPart.Presentation.SlideIdList == null)
            {
                this.presentationPart.Presentation.SlideIdList = new SlideIdList();
            }

            SlideIdList slideIdList = this.presentationPart.Presentation.SlideIdList;
            SlideId     refSlideId  = slideIdList.Elements <SlideId>().Take(index).LastOrDefault();

            uint    id = refSlideId?.Id ?? 256;
            SlideId slideId;

            if (refSlideId != null)
            {
                slideId = slideIdList.InsertAfter(
                    new SlideId()
                {
                    Id = ++id, RelationshipId = presentationPart.GetIdOfPart(slidePart)
                },
                    refSlideId
                    );
            }
            else
            {
                slideId = slideIdList.PrependChild(
                    new SlideId()
                {
                    Id = ++id, RelationshipId = presentationPart.GetIdOfPart(slidePart)
                }
                    );
            }

            for (slideId = slideId.NextSibling <SlideId>(); slideId != null; slideId = slideId.NextSibling <SlideId>())
            {
                slideId.Id = ++id;
            }

            return(new OpenXmlSlide(this, slidePart));
        }
Exemplo n.º 12
0
        private void MergeSlides(string presentationId, string finalPresentation)
        {
            var id = 0;

            using (var myDestDeck = PresentationDocument.Open(finalPresentation, true))
            {
                var destPresPart = myDestDeck.PresentationPart;
                // If the merged presentation does not have a SlideIdList
                // element yet, add it.
                if (destPresPart.Presentation.SlideIdList == null)
                {
                    destPresPart.Presentation.SlideIdList = new SlideIdList();
                }

                // Open the source presentation. This will throw an exception if
                // the source presentation does not exist.
                using (var mySourceDeck = GetPresentationDocument(presentationId, false))
                {
                    var sourcePresPart = mySourceDeck.PresentationPart;

                    // Get unique ids for the slide master and slide lists
                    // for use later.
                    var uniqueId = GetMaxSlideMasterId(destPresPart.Presentation.SlideMasterIdList);

                    var maxSlideId = GetMaxSlideId(destPresPart.Presentation.SlideIdList);

                    // Copy each slide in the source presentation, in order, to
                    // the destination presentation.
                    foreach (var openXmlElement in
                             sourcePresPart.Presentation.SlideIdList)
                    {
                        var slideId = (SlideId)openXmlElement;
                        // Create a unique relationship id.
                        id++;
                        var sp = (SlidePart)sourcePresPart.GetPartById(slideId.RelationshipId);

                        var result = GetUniqueIdOfPresentation(presentationId);

                        var relId = result + id;

                        // Add the slide part to the destination presentation.
                        var destSp = destPresPart.AddPart <SlidePart>(sp, relId);

                        // The slide master part was added. Make sure the
                        // relationship between the main presentation part and
                        // the slide master part is in place.
                        var destMasterPart = destSp.SlideLayoutPart.SlideMasterPart;
                        destPresPart.AddPart(destMasterPart);

                        // Add the slide master id to the slide master id list.
                        uniqueId++;
                        var newSlideMasterId = new SlideMasterId
                        {
                            RelationshipId = destPresPart.GetIdOfPart(destMasterPart),
                            Id             = uniqueId
                        };

                        destPresPart.Presentation.SlideMasterIdList.Append(newSlideMasterId);

                        // Add the slide id to the slide id list.
                        maxSlideId++;
                        var newSlideId = new SlideId
                        {
                            RelationshipId = relId,
                            Id             = maxSlideId
                        };

                        destPresPart.Presentation.SlideIdList.Append(newSlideId);
                    }

                    // Make sure that all slide layout ids are unique.
                    FixSlideLayoutIds(destPresPart, uniqueId);
                }

                //// Save the changes to the destination deck.
                destPresPart.Presentation.Save();
            }
        }
		public SerializationSlideData()
		{
			Id = SlideId.none;
			SlideTitle = "";
			SlideDescription = "";
		}