示例#1
0
        /// <summary>
        /// Append the ThreadingInfo element
        /// </summary>
        /// <param name="filePath">Target excel faile path</param>
        /// <param name="log">Logger</param>
        public void AddElements(string filePath, VerifiableLog log)
        {
            using (PresentationDocument package = PresentationDocument.Open(filePath, true))
            {
                try
                {
                    Comment          comment          = GetComment(package.PresentationPart.SlideParts, 1);
                    CommentExtension commentExtension = new CommentExtension()
                    {
                        Uri = this.ThreadingInfoExtUri
                    };
                    P15.ThreadingInfo threadingInfo = new P15.ThreadingInfo()
                    {
                        TimeZoneBias = this.timeZoneBiasValue
                    };
                    commentExtension.AppendChild <P15.ThreadingInfo>(threadingInfo);
                    comment.CommentExtensionList.AppendChild <CommentExtension>(commentExtension);

                    log.Pass("Added ThreadingInfo element.");
                }
                catch (Exception e)
                {
                    log.Fail(e.Message);
                }
            }
        }
示例#2
0
        /// <summary>
        /// Verifying the ThreadingInfo element the existence
        /// </summary>
        /// <param name="filePath">Target Excel faile path</param>
        /// <param name="log">Logger</param>
        public void VerifyElements(string filePath, VerifiableLog log)
        {
            using (PresentationDocument package = PresentationDocument.Open(filePath, false))
            {
                Comment           comment       = GetComment(package.PresentationPart.SlideParts, 1);
                P15.ThreadingInfo threadingInfo = comment.CommentExtensionList.Descendants <P15.ThreadingInfo>().Single();

                log.Verify(threadingInfo.TimeZoneBias.Value == this.timeZoneBiasValue, "UnChanged in the ThreadingInfo element.");
            }
        }
示例#3
0
        /// <summary>
        /// Editing ThreadingInfo element
        /// </summary>
        /// <param name="filePath">Target Excel file path</param>
        /// <param name="log">Logger</param>
        public void EditElements(string filePath, VerifiableLog log)
        {
            using (PresentationDocument package = PresentationDocument.Open(filePath, true))
            {
                Comment           comment       = GetComment(package.PresentationPart.SlideParts, 1);
                P15.ThreadingInfo threadingInfo = comment.CommentExtensionList.Descendants <P15.ThreadingInfo>().Single();
                threadingInfo.TimeZoneBias.Value = this.timeZoneBiasValue;

                log.Pass("Edited ThreadingInfo value.");
            }
        }
示例#4
0
        /// <summary>
        /// Deleting ThreadingInfo element
        /// </summary>
        /// <param name="filePath">Target Excel faile path</param>
        /// <param name="log">Logger</param>
        public void DeleteElements(string filePath, VerifiableLog log)
        {
            using (PresentationDocument package = PresentationDocument.Open(filePath, true))
            {
                Comment           comment          = GetComment(package.PresentationPart.SlideParts, 1);
                CommentExtension  commentExtension = comment.CommentExtensionList.Descendants <CommentExtension>().Where(e => e.Uri == this.ThreadingInfoExtUri).Single();
                P15.ThreadingInfo threadingInfo    = commentExtension.Descendants <P15.ThreadingInfo>().Single();

                threadingInfo.Remove();
                log.Pass("Deleted ThreadingInfo element.");

                commentExtension.Remove();
                log.Pass("Deleted ThreadingInfo extension element.");
            }
        }
示例#5
0
        /// <summary>
        /// Constructor
        /// Get URI attribute value of CommentExtension
        /// </summary>
        /// <param name="filePath">Generated file path</param>
        public TestEntities(string filePath)
        {
            using (PresentationDocument package = PresentationDocument.Open(filePath, false))
            {
                //Get Extension Uri value
                Comment           comment          = GetComment(package.PresentationPart.SlideParts, 1);
                P15.ThreadingInfo threadingInfo    = comment.CommentExtensionList.Descendants <P15.ThreadingInfo>().Single();
                CommentExtension  commentExtension = (CommentExtension)threadingInfo.Parent;
                this.ThreadingInfoExtUri = commentExtension.Uri;;

                if (string.IsNullOrEmpty(ThreadingInfoExtUri))
                {
                    throw new Exception("Uri attribute value in Extension element is not set.");
                }
            }
        }
示例#6
0
        /// <summary>
        /// Append the ThreadingInfo element
        /// </summary>
        /// <param name="filePath">Target excel faile path</param>
        /// <param name="log">Logger</param>
        public void AddElements(string filePath, VerifiableLog log)
        {
            using (PresentationDocument package = PresentationDocument.Open(filePath, true))
            {
                try
                {
                    Comment comment = GetComment(package.PresentationPart.SlideParts, 1);
                    CommentExtension commentExtension = new CommentExtension() { Uri = this.ThreadingInfoExtUri };
                    P15.ThreadingInfo threadingInfo = new P15.ThreadingInfo() { TimeZoneBias = this.timeZoneBiasValue };
                    commentExtension.AppendChild<P15.ThreadingInfo>(threadingInfo);
                    comment.CommentExtensionList.AppendChild<CommentExtension>(commentExtension);

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