示例#1
0
        private static PresentationPart MakeValidPresentationPart(PresentationPart presentationPart)
        {
            //
            // Presentation
            //
            PresentationBuilder.MakeValidPresentation(
                presentationPart.Presentation ?? (presentationPart.Presentation = new Presentation())
                ).Save(presentationPart);

            //
            // ViewPropertiesPart
            //
            PresentationBuilder.MakeValidViewPropertiesPart(
                presentationPart.ViewPropertiesPart ?? presentationPart.AddNewPartDefaultId <ViewPropertiesPart>()
                );

            //
            // PresentationPropertiesPart
            //
            PresentationBuilder.MakeValidPresentationPropertiesPart(
                presentationPart.PresentationPropertiesPart ?? presentationPart.AddNewPartDefaultId <PresentationPropertiesPart>()
                );

            return(presentationPart);
        }
示例#2
0
        private static PresentationPropertiesPart MakeValidPresentationPropertiesPart(PresentationPropertiesPart presentationPropertiesPart)
        {
            PresentationBuilder.MakeValidPresentationProperties(
                presentationPropertiesPart.PresentationProperties ?? (presentationPropertiesPart.PresentationProperties = new PresentationProperties())
                ).Save(presentationPropertiesPart);

            return(presentationPropertiesPart);
        }
示例#3
0
        private static ViewPropertiesPart MakeValidViewPropertiesPart(ViewPropertiesPart viewPropertiesPart)
        {
            PresentationBuilder.MakeValidViewProperties(
                viewPropertiesPart.ViewProperties ?? (viewPropertiesPart.ViewProperties = new ViewProperties())
                ).Save(viewPropertiesPart);

            return(viewPropertiesPart);
        }
示例#4
0
        public static PresentationDocument BuildDefault(PresentationDocument presentationDocument)
        {
            PresentationBuilder.BuildPresentationScaffold(presentationDocument);

            PresentationPart presentationPart = presentationDocument.PresentationPart;

            ThemeApplier.ApplyTheme(presentationPart, DefaultThemeBuilder.BuildDefaultTheme());
            ThemeApplier.ApplyTableStyles(presentationPart, DefaultThemeBuilder.BuildDefaultTableStyleList());
            ThemeApplier.AppendSlideMaster(presentationPart, DefaultSlideMasterBuilder.BuildDefaultSlideMaster(), DefaultSlideMasterBuilder.BuildDefaultSlideLayouts());

            return(presentationDocument);
        }
示例#5
0
        private static PresentationDocument BuildPresentationScaffold(PresentationDocument presentationDocument)
        {
            presentationDocument.DeletePartsRecursivelyOfType <PresentationPart>();
            presentationDocument.DeletePartsRecursivelyOfType <CoreFilePropertiesPart>();
            presentationDocument.DeletePartsRecursivelyOfType <ExtendedFilePropertiesPart>();

            presentationDocument.ChangeIdOfPart(presentationDocument.AddPresentationPart(), "rId1");
            PresentationBuilder.MakeValidPresentationPart(presentationDocument.PresentationPart);

            presentationDocument.ChangeIdOfPart(presentationDocument.AddCoreFilePropertiesPart(), "rId2");
            PresentationBuilder.MakeValidCoreFilePropertiesPart(presentationDocument.CoreFilePropertiesPart);

            presentationDocument.ChangeIdOfPart(presentationDocument.AddExtendedFilePropertiesPart(), "rId3");
            PresentationBuilder.MakeValidExtendedFilePropertiesPart(presentationDocument.ExtendedFilePropertiesPart);

            return(presentationDocument);
        }
示例#6
0
        public static PresentationDocument BuildFromThemeDocument(PresentationDocument presentationDocument, PresentationDocument themePresentationDocument)
        {
            PresentationBuilder.BuildPresentationScaffold(presentationDocument);

            PresentationPart presentationPart      = presentationDocument.PresentationPart;
            PresentationPart themePresentationPart = themePresentationDocument.PresentationPart;

            ThemeApplier.ApplyTheme(presentationPart, themePresentationPart.ThemePart.Theme);
            ThemeApplier.ApplyTableStyles(presentationPart, themePresentationPart.TableStylesPart.TableStyleList);

            foreach (SlideMasterPart themeSlideMasterPart in themePresentationPart.SlideMasterParts)
            {
                // ThemeApplier.AppendSlideMaster(presentationPart, themeSlideMasterPart.SlideMaster, ThemeApplier.ExtractSlideLayouts(themeSlideMasterPart));
                ThemeApplier.AppendSlideMasterFromPart(presentationPart, themePresentationPart, themeSlideMasterPart);
            }

            return(presentationDocument);
        }