private static void AddSlideMasterToSlideMasterIdList(PresentationPart presentationPart, SlideMasterPart slideMasterPart) { Presentation presentation = presentationPart.Presentation; SlideMasterIdList slideMasterIdList = presentationPart.Presentation.SlideMasterIdList; slideMasterIdList.AppendChild(new SlideMasterId() { Id = slideMasterIdList.Elements <SlideMasterId>().Select(sm => sm.Id.Value).DefaultIfEmpty(2147483647u).Max() + 1, RelationshipId = presentationPart.GetIdOfPart(slideMasterPart) }); presentation.Save(presentationPart); }
private uint GetMaxSlideMasterId(SlideMasterIdList slideMaterIdList) { uint max = 2147483648; if (slideMaterIdList != null) { foreach (SlideMasterId child in slideMaterIdList.Elements <SlideMasterId>()) { uint id = child.Id; if (id > max) { max = id; } } } return(max); }
private uint GetMaxSlideMasterId(SlideMasterIdList slideMasterIdList) { // Slide master identifiers have a minimum value of greater than or equal to 2147483648. uint max = 2147483648; if (slideMasterIdList != null) { // Get the maximum id value from the current set of children. foreach (SlideMasterId child in slideMasterIdList.Elements <SlideMasterId>()) { uint id = child.Id; if (id > max) { max = id; } } } return(max); }