Exemple #1
0
        /// <summary>
        /// Append the chartTrackingReferenceBased element
        /// </summary>
        public void AddElements(Stream stream, VerifiableLog log)
        {
            using (PresentationDocument package = PresentationDocument.Open(stream, true))
            {
                PresentationPropertiesExtension presentationPropertiesExtension = new PresentationPropertiesExtension() { Uri = ChartTrackingReferenceBasedExtUri };
                P15.ChartTrackingReferenceBased chartTrackingReferenceBased = new P15.ChartTrackingReferenceBased();
                chartTrackingReferenceBased.Val = true;

                presentationPropertiesExtension.AppendChild<P15.ChartTrackingReferenceBased>(chartTrackingReferenceBased);
                package.PresentationPart.PresentationPropertiesPart.PresentationProperties.PresentationPropertiesExtensionList.AppendChild<PresentationPropertiesExtension>(presentationPropertiesExtension);

                log.Pass("Added ChartTrackingReferenceBased element.");
            }
        }
        /// <summary>
        /// Append the chartTrackingReferenceBased element
        /// </summary>
        /// <param name="filePath">Target file path</param>
        /// <param name="log">Logger</param>
        public void AddElements(string filePath, VerifiableLog log)
        {
            using (PresentationDocument package = PresentationDocument.Open(filePath, true))
            {
                try
                {
                    PresentationPropertiesExtension presentationPropertiesExtension = new PresentationPropertiesExtension()
                    {
                        Uri = this.ChartTrackingReferenceBasedExtUri
                    };
                    P15.ChartTrackingReferenceBased chartTrackingReferenceBased = new P15.ChartTrackingReferenceBased();
                    chartTrackingReferenceBased.Val = true;

                    presentationPropertiesExtension.AppendChild <P15.ChartTrackingReferenceBased>(chartTrackingReferenceBased);
                    package.PresentationPart.PresentationPropertiesPart.PresentationProperties.PresentationPropertiesExtensionList.AppendChild <PresentationPropertiesExtension>(presentationPropertiesExtension);

                    log.Pass("Added ChartTrackingReferenceBased element.");
                }
                catch (Exception e)
                {
                    log.Fail(e.Message);
                }
            }
        }