// This code is part of GrapeCity Documents for Word samples.
// Copyright (c) GrapeCity, Inc. All rights reserved.
// This sample is identical to Comments. The only difference is
// that in PDF export, comments are ignored. This is achieved by
// providing a GetPdfConversionOptions method used by the sample
// browser's infrastructure when it calls the SaveAsPdf method
// on the generated document.
public class CommentsNoPdf
public GcWordDocument CreateDocx()
var user1 = "Jaime Smith"; // user name for comments' author
var user2 = "Jane Donahue"; // user name for comments' author
var doc = new GcWordDocument();
var pars = doc.Body.Paragraphs;
var p1 = pars.Add("Paragraph 1: This is a paragraph of text with a comment added to the whole paragraph. ");
var c1 = p1.GetRange().Comments.Add("Comment added to paragraph 1.", user1, DateTime.Now, "J.S.");
var c2 = c1.Reply("Reply to comment 1.", user2);
var c3 = c2.Reply("Reply to comment 2, closing the thread.", user1);
c3.Done = true;
var p2 = pars.Add("Paragraph 2: This is another paragraph of text, with a comment added to 3rd run. ");
p2.GetRange().Runs.Add("This is run 2 of paragraph 2. ");
var r = p2.GetRange().Runs.Add("This is run 3 of paragraph 2 with a comment. ");
r.GetRange().Comments.Insert("Comment on run 3 of paragraph 2", user2, RangeLocation.Whole);
p2.GetRange().Runs.Add("This is run 4 of paragraph 2. ");
p2.GetRange().Runs.Add("This is run 5 of paragraph 2. ");
p2.GetRange().Runs.Add("This is run 6 of paragraph 2. ");
// Optional static method. If it is defined on a sample class,
// these options are used when saving the document to PDF.
public static WordLayoutSettings GetWordLayoutSettings()
return new WordLayoutSettings()
CommentMode = WordCommentMode.None