本文整理汇总了C#中Comment.Append方法的典型用法代码示例。如果您正苦于以下问题:C# Comment.Append方法的具体用法?C# Comment.Append怎么用?C# Comment.Append使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Comment
的用法示例。
在下文中一共展示了Comment.Append方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GenerateWorksheetCommentsPartContent
private static void GenerateWorksheetCommentsPartContent(WorksheetCommentsPart worksheetCommentsPart,
XLWorksheet xlWorksheet)
{
var comments = new Comments();
var commentList = new CommentList();
var authorsDict = new Dictionary<String, Int32>();
foreach (var c in xlWorksheet.Internals.CellsCollection.GetCells(c => c.HasComment))
{
var comment = new Comment {Reference = c.Address.ToStringRelative()};
var authorName = c.Comment.Author;
Int32 authorId;
if (!authorsDict.TryGetValue(authorName, out authorId))
{
authorId = authorsDict.Count;
authorsDict.Add(authorName, authorId);
}
comment.AuthorId = (UInt32)authorId;
var commentText = new CommentText();
foreach (var rt in c.Comment)
{
commentText.Append(GetRun(rt));
}
comment.Append(commentText);
commentList.Append(comment);
}
var authors = new Authors();
foreach (var author in authorsDict.Select(a => new Author {Text = a.Key}))
{
authors.Append(author);
}
comments.Append(authors);
comments.Append(commentList);
worksheetCommentsPart.Comments = comments;
}
示例2: GenerateWordprocessingCommentsPart1Content
// Generates content of wordprocessingCommentsPart1.
private void GenerateWordprocessingCommentsPart1Content(WordprocessingCommentsPart wordprocessingCommentsPart1)
{
Comments comments1 = new Comments(){ MCAttributes = new MarkupCompatibilityAttributes(){ Ignorable = "w14 w15 wp14" } };
comments1.AddNamespaceDeclaration("wpc", "http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas");
comments1.AddNamespaceDeclaration("mc", "http://schemas.openxmlformats.org/markup-compatibility/2006");
comments1.AddNamespaceDeclaration("o", "urn:schemas-microsoft-com:office:office");
comments1.AddNamespaceDeclaration("r", "http://schemas.openxmlformats.org/officeDocument/2006/relationships");
comments1.AddNamespaceDeclaration("m", "http://schemas.openxmlformats.org/officeDocument/2006/math");
comments1.AddNamespaceDeclaration("v", "urn:schemas-microsoft-com:vml");
comments1.AddNamespaceDeclaration("wp14", "http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing");
comments1.AddNamespaceDeclaration("wp", "http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing");
comments1.AddNamespaceDeclaration("w10", "urn:schemas-microsoft-com:office:word");
comments1.AddNamespaceDeclaration("w", "http://schemas.openxmlformats.org/wordprocessingml/2006/main");
comments1.AddNamespaceDeclaration("w14", "http://schemas.microsoft.com/office/word/2010/wordml");
comments1.AddNamespaceDeclaration("w15", "http://schemas.microsoft.com/office/word/2012/wordml");
comments1.AddNamespaceDeclaration("wpg", "http://schemas.microsoft.com/office/word/2010/wordprocessingGroup");
comments1.AddNamespaceDeclaration("wpi", "http://schemas.microsoft.com/office/word/2010/wordprocessingInk");
comments1.AddNamespaceDeclaration("wne", "http://schemas.microsoft.com/office/word/2006/wordml");
comments1.AddNamespaceDeclaration("wps", "http://schemas.microsoft.com/office/word/2010/wordprocessingShape");
Comment comment1 = new Comment(){ Initials = "M.T", Author = "Masaki Tamura (Pasona Tech)", Date = System.Xml.XmlConvert.ToDateTime("2012-04-04T13:52:00Z", System.Xml.XmlDateTimeSerializationMode.RoundtripKind), Id = "1" };
Paragraph paragraph2 = new Paragraph(){ RsidParagraphAddition = "00C47703", RsidRunAdditionDefault = "00C47703", ParagraphId = "61B2BF87", TextId = "77777777" };
ParagraphProperties paragraphProperties1 = new ParagraphProperties();
ParagraphStyleId paragraphStyleId1 = new ParagraphStyleId(){ Val = "CommentText" };
paragraphProperties1.Append(paragraphStyleId1);
Run run4 = new Run();
RunProperties runProperties4 = new RunProperties();
RunStyle runStyle3 = new RunStyle(){ Val = "CommentReference" };
runProperties4.Append(runStyle3);
AnnotationReferenceMark annotationReferenceMark1 = new AnnotationReferenceMark();
run4.Append(runProperties4);
run4.Append(annotationReferenceMark1);
Run run5 = new Run();
RunProperties runProperties5 = new RunProperties();
RunFonts runFonts5 = new RunFonts(){ Hint = FontTypeHintValues.EastAsia };
runProperties5.Append(runFonts5);
Text text2 = new Text();
text2.Text = "A";
run5.Append(runProperties5);
run5.Append(text2);
paragraph2.Append(paragraphProperties1);
paragraph2.Append(run4);
paragraph2.Append(run5);
comment1.Append(paragraph2);
Comment comment2 = new Comment(){ Initials = "M.T", Author = "Masaki Tamura (Pasona Tech)", Date = System.Xml.XmlConvert.ToDateTime("2012-04-04T13:52:00Z", System.Xml.XmlDateTimeSerializationMode.RoundtripKind), Id = "2" };
Paragraph paragraph3 = new Paragraph(){ RsidParagraphAddition = "00C47703", RsidRunAdditionDefault = "00C47703", ParagraphId = "216A897E", TextId = "77777777" };
ParagraphProperties paragraphProperties2 = new ParagraphProperties();
ParagraphStyleId paragraphStyleId2 = new ParagraphStyleId(){ Val = "CommentText" };
paragraphProperties2.Append(paragraphStyleId2);
Run run6 = new Run();
RunProperties runProperties6 = new RunProperties();
RunStyle runStyle4 = new RunStyle(){ Val = "CommentReference" };
runProperties6.Append(runStyle4);
AnnotationReferenceMark annotationReferenceMark2 = new AnnotationReferenceMark();
run6.Append(runProperties6);
run6.Append(annotationReferenceMark2);
Run run7 = new Run();
RunProperties runProperties7 = new RunProperties();
RunFonts runFonts6 = new RunFonts(){ Hint = FontTypeHintValues.EastAsia };
runProperties7.Append(runFonts6);
Text text3 = new Text();
text3.Text = "B";
run7.Append(runProperties7);
run7.Append(text3);
paragraph3.Append(paragraphProperties2);
paragraph3.Append(run6);
paragraph3.Append(run7);
comment2.Append(paragraph3);
comments1.Append(comment1);
comments1.Append(comment2);
//.........这里部分代码省略.........
示例3: GenerateWorksheetCommentsPart1Content
// Generates content of worksheetCommentsPart1.
private void GenerateWorksheetCommentsPart1Content(WorksheetCommentsPart worksheetCommentsPart1)
{
Comments comments1 = new Comments();
Authors authors1 = new Authors();
Author author1 = new Author();
author1.Text = "Author";
authors1.Append(author1);
CommentList commentList1 = new CommentList();
Comment comment1 = new Comment() { Reference = "V10", AuthorId = (UInt32Value)0U, ShapeId = (UInt32Value)0U };
CommentText commentText1 = new CommentText();
Run run14 = new Run();
RunProperties runProperties14 = new RunProperties();
Bold bold1 = new Bold();
FontSize fontSize1 = new FontSize() { Val = 9D };
Color color1 = new Color() { Indexed = (UInt32Value)81U };
RunFont runFont1 = new RunFont() { Val = "Tahoma" };
RunPropertyCharSet runPropertyCharSet1 = new RunPropertyCharSet() { Val = 1 };
runProperties14.Append(bold1);
runProperties14.Append(fontSize1);
runProperties14.Append(color1);
runProperties14.Append(runFont1);
runProperties14.Append(runPropertyCharSet1);
Text text14 = new Text();
text14.Text = "Author:";
run14.Append(runProperties14);
run14.Append(text14);
Run run15 = new Run();
RunProperties runProperties15 = new RunProperties();
FontSize fontSize2 = new FontSize() { Val = 9D };
Color color2 = new Color() { Indexed = (UInt32Value)81U };
RunFont runFont2 = new RunFont() { Val = "Tahoma" };
RunPropertyCharSet runPropertyCharSet2 = new RunPropertyCharSet() { Val = 1 };
runProperties15.Append(fontSize2);
runProperties15.Append(color2);
runProperties15.Append(runFont2);
runProperties15.Append(runPropertyCharSet2);
Text text15 = new Text() { Space = SpaceProcessingModeValues.Preserve };
text15.Text = "\nThis is a comment";
run15.Append(runProperties15);
run15.Append(text15);
commentText1.Append(run14);
commentText1.Append(run15);
comment1.Append(commentText1);
commentList1.Append(comment1);
comments1.Append(authors1);
comments1.Append(commentList1);
worksheetCommentsPart1.Comments = comments1;
}