예제 #1
0
        public SlideLayoutPart AddLayoutPartWithInstanceId(UInt32 instanceId)
        {
            SlideMasterPart masterPart = _ctx.GetOrCreateMasterMappingByMasterId(this.MasterId).MasterPart;
            SlideLayoutPart layoutPart = masterPart.AddSlideLayoutPart();

            this.InstanceIdToLayoutPart.Add(instanceId, layoutPart);
            return(layoutPart);
        }
예제 #2
0
        public SlideLayoutPart GetOrCreateLayoutPartForTitleMasterId(UInt32 titleMasterId)
        {
            SlideMasterPart masterPart = _ctx.GetOrCreateMasterMappingByMasterId(this.MasterId).MasterPart;

            if (!this.TitleMasterIdToLayoutPart.ContainsKey(titleMasterId))
            {
                Slide           titleMaster = _ctx.Ppt.FindMasterRecordById(titleMasterId);
                SlideLayoutPart layoutPart  = masterPart.AddSlideLayoutPart();
                new TitleMasterMapping(_ctx, layoutPart).Apply(titleMaster);
                this.TitleMasterIdToLayoutPart.Add(titleMasterId, layoutPart);
            }

            return(this.TitleMasterIdToLayoutPart[titleMasterId]);
        }
예제 #3
0
        public SlideLayoutPart GetOrCreateLayoutPartByCode(string xml)
        {
            SlideMasterPart masterPart = _ctx.GetOrCreateMasterMappingByMasterId(this.MasterId).MasterPart;

            if (!this.CodeToLayoutPart.ContainsKey(xml))
            {
                XmlDocument doc = new XmlDocument();
                doc.LoadXml(xml);

                SlideLayoutPart layoutPart = masterPart.AddSlideLayoutPart();
                doc.WriteTo(layoutPart.XmlWriter);
                layoutPart.XmlWriter.Flush();
                CodeToLayoutPart.Add(xml, layoutPart);
            }

            return(CodeToLayoutPart[xml]);
        }
예제 #4
0
        public SlideLayoutPart GetOrCreateLayoutPartByLayoutType(SlideLayoutType type,
                                                                 PlaceholderEnum[] placeholderTypes)
        {
            SlideMasterPart masterPart     = _ctx.GetOrCreateMasterMappingByMasterId(this.MasterId).MasterPart;
            string          layoutFilename = Utils.SlideLayoutTypeToFilename(type, placeholderTypes);


            if (!this.LayoutFilenameToLayoutPart.ContainsKey(layoutFilename))
            {
                XmlDocument slideLayoutDoc = Utils.GetDefaultDocument("slideLayouts." + layoutFilename);

                SlideLayoutPart layoutPart = masterPart.AddSlideLayoutPart();
                slideLayoutDoc.WriteTo(layoutPart.XmlWriter);
                layoutPart.XmlWriter.Flush();

                this.LayoutFilenameToLayoutPart.Add(layoutFilename, layoutPart);
            }

            return(this.LayoutFilenameToLayoutPart[layoutFilename]);
        }