/// <summary> /// Gets all of the comments from inside a document in a given format /// </summary> /// <param name="format">Format to return data</param> /// <returns>Comments</returns> public object GetAll(CommentFormat format) { IEnumerable <XElement> comments = CommentContents(); XDocument commentsDocument = new XDocument( new XElement(ns + "comments", new XAttribute(XNamespace.Xmlns + "w", ns), comments ) ); if (comments != null) { switch (format) { case CommentFormat.PlainText: return(commentsDocument.ToString()); case CommentFormat.Xml: return(commentsDocument); case CommentFormat.Docx: return(CreateCommentDocument(comments)); default: return(null); } } else { return(null); } }
public static object GetAllComments(WmlDocument doc, CommentFormat format) { using (OpenXmlMemoryStreamDocument streamDoc = new OpenXmlMemoryStreamDocument(doc)) using (WordprocessingDocument document = streamDoc.GetWordprocessingDocument()) { IEnumerable<XElement> comments = null; WordprocessingCommentsPart commentsPart = document.MainDocumentPart.WordprocessingCommentsPart; if (commentsPart != null) { XDocument commentsPartDocument = commentsPart.GetXDocument(); comments = commentsPartDocument.Element(W.comments).Elements(W.comment); } if (comments != null) { XDocument commentsDocument = new XDocument( new XElement(W.comments, new XAttribute(XNamespace.Xmlns + "w", W.w), comments ) ); switch (format) { case CommentFormat.PlainText: return commentsDocument.ToString(); case CommentFormat.Xml: return commentsDocument; case CommentFormat.Docx: return CreateCommentsDocument(comments); } } return null; } }
internal override void Close() { base.Close(); if (this.m_textBody != null) { this.m_textBody.method_28(); this.m_textBody = null; } this.m_format = null; this.textBodyPart_0 = null; this.paragraphItemCollection_1 = null; this.commentsCollection_0 = null; }
public static object GetAllComments(WmlDocument doc, CommentFormat format) { using (OpenXmlMemoryStreamDocument streamDoc = new OpenXmlMemoryStreamDocument(doc)) using (WordprocessingDocument document = streamDoc.GetWordprocessingDocument()) { IEnumerable <XElement> comments = null; WordprocessingCommentsPart commentsPart = document.MainDocumentPart.WordprocessingCommentsPart; if (commentsPart != null) { XDocument commentsPartDocument = commentsPart.GetXDocument(); comments = commentsPartDocument.Element(W.comments).Elements(W.comment); } if (comments != null) { XDocument commentsDocument = new XDocument( new XElement(W.comments, new XAttribute(XNamespace.Xmlns + "w", W.w), comments ) ); switch (format) { case CommentFormat.PlainText: return(commentsDocument.ToString()); case CommentFormat.Xml: return(commentsDocument); case CommentFormat.Docx: return(CreateCommentsDocument(comments)); } } return(null); } }
/// <summary> /// GetAllComments /// </summary> public override object GetAllComments(CommentFormat format) { return(Comments.GetAll(format)); }
/// <summary> /// AcceptAllChanges /// </summary> public virtual object GetAllComments(CommentFormat format) { throw new InvalidOperationException("Document does not support comments."); }
/// <summary> /// GetAllComments /// </summary> public override object GetAllComments(CommentFormat format) { throw new InvalidOperationException("Operation not yet supported for Spreadsheets."); }
public object GetAllComments(CommentFormat format) { return CommentAccessor.GetAllComments(this, format); }
public Comment(IDocument doc) : base((Document)doc) { this.m_format = new CommentFormat(); this.m_textBody = new Spire.Doc.Body(base.Document, this); }
public object GetAllComments(CommentFormat format) { return(CommentAccessor.GetAllComments(this, format)); }