/// <summary> /// Verifying the ThreadingInfo element the existence /// </summary> public void VerifyElements(Stream stream, VerifiableLog log) { using (PresentationDocument package = PresentationDocument.Open(stream, false)) { Comment comment = GetComment(package.PresentationPart.SlideParts, 1); P15.ThreadingInfo threadingInfo = comment.CommentExtensionList.Descendants <P15.ThreadingInfo>().Single(); log.Verify(threadingInfo.TimeZoneBias.Value == timeZoneBiasValue, "UnChanged in the ThreadingInfo element."); } }
/// <summary> /// Editing ThreadingInfo element /// </summary> public void EditElements(Stream stream, VerifiableLog log) { using (PresentationDocument package = PresentationDocument.Open(stream, true)) { Comment comment = GetComment(package.PresentationPart.SlideParts, 1); P15.ThreadingInfo threadingInfo = comment.CommentExtensionList.Descendants <P15.ThreadingInfo>().Single(); threadingInfo.TimeZoneBias.Value = timeZoneBiasValue; log.Pass("Edited ThreadingInfo value."); } }
/// <summary> /// Deleting ThreadingInfo element /// </summary> public void DeleteElements(Stream stream, VerifiableLog log) { using (PresentationDocument package = PresentationDocument.Open(stream, true)) { Comment comment = GetComment(package.PresentationPart.SlideParts, 1); CommentExtension commentExtension = comment.CommentExtensionList.Descendants <CommentExtension>().Where(e => e.Uri == 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."); } }
/// <summary> /// Constructor /// Get URI attribute value of CommentExtension /// </summary> public TestEntities(Stream stream) { using (PresentationDocument package = PresentationDocument.Open(stream, 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; ThreadingInfoExtUri = commentExtension.Uri; if (string.IsNullOrEmpty(ThreadingInfoExtUri)) { throw new Exception("Uri attribute value in Extension element is not set."); } } }
/// <summary> /// Append the ThreadingInfo element /// </summary> public void AddElements(Stream stream, VerifiableLog log) { using (PresentationDocument package = PresentationDocument.Open(stream, true)) { Comment comment = GetComment(package.PresentationPart.SlideParts, 1); CommentExtension commentExtension = new CommentExtension() { Uri = ThreadingInfoExtUri }; P15.ThreadingInfo threadingInfo = new P15.ThreadingInfo() { TimeZoneBias = timeZoneBiasValue }; commentExtension.AppendChild <P15.ThreadingInfo>(threadingInfo); comment.CommentExtensionList.AppendChild <CommentExtension>(commentExtension); log.Pass("Added ThreadingInfo element."); } }
// Generates content of slideCommentsPart1. private void GenerateSlideCommentsPart1Content(SlideCommentsPart slideCommentsPart1) { CommentList commentList1 = new CommentList(); commentList1.AddNamespaceDeclaration("a", "http://schemas.openxmlformats.org/drawingml/2006/main"); commentList1.AddNamespaceDeclaration("r", "http://schemas.openxmlformats.org/officeDocument/2006/relationships"); commentList1.AddNamespaceDeclaration("p", "http://schemas.openxmlformats.org/presentationml/2006/main"); Comment comment1 = new Comment(){ AuthorId = (UInt32Value)0U, DateTime = System.Xml.XmlConvert.ToDateTime("2008-01-03T13:29:23.575Z", System.Xml.XmlDateTimeSerializationMode.RoundtripKind), Index = (UInt32Value)1U }; Position position1 = new Position(){ X = 10L, Y = 10L }; Text text8 = new Text(); text8.Text = "TEsting Comment"; CommentExtensionList commentExtensionList1 = new CommentExtensionList(); CommentExtension commentExtension1 = new CommentExtension(){ Uri = "{C676402C-5697-4E1C-873F-D02D1690AC5C}" }; P15.ThreadingInfo threadingInfo1 = new P15.ThreadingInfo(){ TimeZoneBias = -540 }; threadingInfo1.AddNamespaceDeclaration("p15", "http://schemas.microsoft.com/office/powerpoint/2012/main"); commentExtension1.Append(threadingInfo1); commentExtensionList1.Append(commentExtension1); comment1.Append(position1); comment1.Append(text8); comment1.Append(commentExtensionList1); Comment comment2 = new Comment(){ AuthorId = (UInt32Value)0U, DateTime = System.Xml.XmlConvert.ToDateTime("2008-01-03T13:29:45.682Z", System.Xml.XmlDateTimeSerializationMode.RoundtripKind), Index = (UInt32Value)2U }; Position position2 = new Position(){ X = 2721L, Y = 913L }; Text text9 = new Text(); text9.Text = "TEsting Comment"; CommentExtensionList commentExtensionList2 = new CommentExtensionList(); CommentExtension commentExtension2 = new CommentExtension(){ Uri = "{C676402C-5697-4E1C-873F-D02D1690AC5C}" }; P15.ThreadingInfo threadingInfo2 = new P15.ThreadingInfo(){ TimeZoneBias = -540 }; threadingInfo2.AddNamespaceDeclaration("p15", "http://schemas.microsoft.com/office/powerpoint/2012/main"); commentExtension2.Append(threadingInfo2); commentExtensionList2.Append(commentExtension2); comment2.Append(position2); comment2.Append(text9); comment2.Append(commentExtensionList2); commentList1.Append(comment1); commentList1.Append(comment2); slideCommentsPart1.CommentList = commentList1; }