/// <summary> /// Deleting chartTrackingReferenceBased element /// </summary> public void DeleteElements(Stream stream, VerifiableLog log) { using (PresentationDocument package = PresentationDocument.Open(stream, true)) { PresentationPropertiesExtension presentationPropertiesExtension = package.PresentationPart.PresentationPropertiesPart.PresentationProperties.PresentationPropertiesExtensionList.Descendants <PresentationPropertiesExtension>().Where(e => e.Uri == ChartTrackingReferenceBasedExtUri).Single(); P15.ChartTrackingReferenceBased chartTrackingReferenceBased = presentationPropertiesExtension.Descendants <P15.ChartTrackingReferenceBased>().Single(); chartTrackingReferenceBased.Remove(); presentationPropertiesExtension.Remove(); log.Pass("Deleted chartTrackingReferenceBased element."); } }
/// <summary> /// Deleting chartTrackingReferenceBased element /// </summary> /// <param name="filePath">Target faile path</param> /// <param name="log">Logger</param> public void DeleteElements(string filePath, VerifiableLog log) { using (PresentationDocument package = PresentationDocument.Open(filePath, true)) { try { PresentationPropertiesExtension presentationPropertiesExtension = package.PresentationPart.PresentationPropertiesPart.PresentationProperties.PresentationPropertiesExtensionList.Descendants <PresentationPropertiesExtension>().Where(e => e.Uri == this.ChartTrackingReferenceBasedExtUri).Single(); P15.ChartTrackingReferenceBased chartTrackingReferenceBased = presentationPropertiesExtension.Descendants <P15.ChartTrackingReferenceBased>().Single(); chartTrackingReferenceBased.Remove(); presentationPropertiesExtension.Remove(); log.Pass("Deleted chartTrackingReferenceBased element."); } catch (Exception e) { log.Fail(e.Message); } } }