Exemplo n.º 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);
        }
Exemplo n.º 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]);
        }
Exemplo n.º 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]);
        }
Exemplo n.º 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]);
        }