Beispiel #1
0
        public static void CreatePresentationPart(PresentationPart part, PPTXSetting FileSettings, PPTXSlideLayoutGroup SlideLayouts)
        {
            var partCreator = new DefaultPresentationPart();

            partCreator._CreatePresentationPart(part);

            SlidePart slidePart1 = DefaultSlidePart.CreateSlidePart(part, "rId2", FileSettings);

            // 1枚目のスライド追加
            var topLayoutPart = new SlideLayout_TitleSlide();

            topLayoutPart.Init(EPPTXSlideLayoutType.TitleSlide, SlideLayouts);
            SlideLayoutPart slideLayoutPart1 = topLayoutPart.CreateSlideLayoutPart(slidePart1);
            SlideMasterPart slideMasterPart1 = DefaultSlideMasterPart.CreateSlideMasterPart(slideLayoutPart1, "rId1");
            ThemePart       themePart1       = DefaultTheme.CreateTheme(slideMasterPart1);

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

            // 残りのスライドレイアウトを追加
            foreach (EPPTXSlideLayoutType layoutType in Enum.GetValues(typeof(EPPTXSlideLayoutType)))
            {
                if (layoutType == EPPTXSlideLayoutType.TitleSlide)
                {
                    continue;
                }

                var otherLayoutPartType = Type.GetType($"MDToPPTX.PPTX.DefaultParts.SlideLayouts.SlideLayout_{layoutType.ToString()}");
                if (otherLayoutPartType == null)
                {
                    continue;
                }
                SlideLayoutPartBase otherLayoutPart = Activator.CreateInstance(otherLayoutPartType) as SlideLayoutPartBase;
                if (otherLayoutPart != null)
                {
                    otherLayoutPart.Init(layoutType, SlideLayouts);
                    SlideLayoutPart otherSlideLayoutPart = otherLayoutPart.CreateSlideLayoutPart(slideMasterPart1);

                    otherSlideLayoutPart.AddPart(slideMasterPart1, "rId1");
                }
            }
        }
Beispiel #2
0
 public SlideWriter(PPTXSlide SlideContent, PPTXSlideLayoutGroup SlideLayouts)
 {
     this.SlideContent = SlideContent;
     this.SlideLayouts = SlideLayouts;
 }
        public static PresentationDocument CreatePresentationDocument(string FilePath, PPTXSetting FileSettings, PPTXSlideLayoutGroup SlideLayouts)
        {
            var presentationDoc = PresentationDocument.Create(FilePath, PresentationDocumentType.Presentation);
            PresentationPart presentationPart = presentationDoc.AddPresentationPart();

            presentationPart.Presentation = new Presentation();

            DefaultPresentationPart.CreatePresentationPart(presentationPart, FileSettings, SlideLayouts);

            return(presentationDoc);
        }
Beispiel #4
0
 public void Init(EPPTXSlideLayoutType LayoutType, PPTXSlideLayoutGroup SlideLayouts)
 {
     this.LayoutSetting = SlideLayouts.SlideLayouts[LayoutType];
 }