Edit Article

It can be very difficult when reading literature maybe for your own leisure or for school to understand the text fully. Thus, making notes becomes an indispensable step to reading and understanding a text. When people read the e-book in word document, it is convenient to use the word comments feature to make notes compared with writing them onto notebook.

Ad

Steps

  1. 1
    Create a Word Comments project in Visual Studio.
    • Open Visual Studio (2008 or later)
    • Go to:
      • File—New Project—Visual C#—Windows Forms Application.
      • If you need to create a Visual Basic project, Windows Forms Application, you can name the project Word Comments.
      • Click ‘OK’.
    Ad
  2. 2
    Add a button in Word Comments project.
    • After building project Word Comments in Form 1, you will need to add a button in Form1.
  3. 3
    Add references.
    • Open Solution Explorer.
      • Click project —Add Reference—Find "C:\Program Files\e-iceblue\Spire.Doc"(the default folder which you installed the Spire Doc in)
      • Double-click the folder Bin.
    • If the target framework of the project is:
      • Net 2.0, double-click folder NET2.0.
      • Net 3.5, double-click folder NET3.5.
      • Net 4.0, double-click folder NET4.0.
    • Select assembly Spire Doc dll and click ‘OK’
  4. 4
    View the method.
    • After you create the project Word Comments, double-click “button1”, you can see the cold view and the following method has been added automatically.
    • Below is the encoding
    Ad
    Ad
  • C#
  • private void button1_Click(object sender, EventArgs e)
  • VB.NET
  • Private Sub button1_Click(ByVal sender As Object, ByVal e As EventArgs) *Handles button1.Click
  • Add the following codes to the top of the file:
  • C#
  • using Spire.Doc;
  • using Spire.Doc.Documents;
  • VB.NET
  • Imports Spire.Doc
  • Imports Spire.Doc.Documents
  • Add the following codes to the method.
  • C#
  • private void button1_Click(object sender, EventArgs e)
  • {
  • //Create word document
  • Document document = new Document();
  • InsertComments(document.AddSection());
  • //Save doc file.
  • document.SaveToFile("Sample.doc",FileFormat.Doc);
  • //Launching the MS Word file.
  • WordDocViewer("Sample.doc");
  • }
  • private void InsertComments(Section section)
  • {
  • Paragraph paragraph = section.AddParagraph();
  • paragraph.AppendText("The sample demonstrates how to insert a comment into a document.");
  • paragraph.ApplyStyle(BuiltinStyle.Heading2);
  • paragraph = section.AddParagraph();
  • paragraph.AppendText("Spire.Doc can generate, modify, convert, render and print *documents without utilizing Microsoft Word.");
  • paragraph.AppendComment("This is a comment");
  • paragraph = section.AddParagraph();
  • paragraph.AppendTextMicrosoft
  • }
  • private void WordDocViewer(string fileName)
  • {
  • try
  • {
  • System.Diagnostics.Process.Start(fileName);
  • }
  • catch { }
  • }
  • VB.NET
  • Private Sub button1_Click(ByVal sender As Object, ByVal e As EventArgs) *Handles button1.Click
  • 'Create word document
  • Dim document_Renamed As New Document()
  • InsertComments(document_Renamed.AddSection())
  • 'Save doc file.
  • document_Renamed.SaveToFile("Sample.doc",FileFormat.Doc)
  • 'Launching the MS Word file.
  • WordDocViewer("Sample.doc")
  • End Sub
  • Private Sub InsertComments(ByVal section_Renamed As Section)

Dim paragraph_Renamed As Paragraph = section_Renamed.AddParagraph() paragraph_Renamed.AppendText("The sample demonstrates how to insert a comment into a document.")

  • paragraph_Renamed.ApplyStyle(BuiltinStyle.Heading2)
  • paragraph_Renamed = section_Renamed.AddParagraph()
  • paragraph_Renamed.AppendText("comment demonstration")
  • paragraph_Renamed.AppendComment("This is a comment")
  • End Sub
  • Private Sub WordDocViewer(ByVal fileName As String)
  • Try
  • Process.Start(fileName)
  • Catch
  • End Try
  • End Sub

We could really use your help!

Can you tell us about
Droid Razr?
Can you help us
rate articles?
Yes
No
Droid Razr
how to remove the battery from Droid Razr
Can you tell us about
lock-picking?
Yes
No
lock-picking
different ways to open a lock
Can you tell us about
Adobe Photoshop?
Yes
No
Adobe Photoshop
how to transform an image in Photoshop
Can you tell us about
tanning?
Yes
No
tanning
how to tan in sun
Thanks for helping! Please tell us everything you know about
...
Tell us everything you know here. Remember, more detail is better.
Tips
Provide Details.
Please be as detailed as possible in your explanation. Don't worry about formatting! We'll take care of it. For example:
Don't say: Eat more fats.
Do say: Add fats with some nutritional value to the foods you already eat. Try olive oil, butter, avocado, and mayonnaise.

Tips

  • In Solution Explorer, right-click the project Word Comments—Click Debug—Start new instance, you can see the opened window Form1—Click button 1, a comment in the document shows itself. Look at the picture 7.1 above.
  • Word is a word processor designed by Microsoft. It was first released in 1983 under the name Multi-Tool Word for Xenix systems. Subsequent versions were later written for several other platforms including IBM PCs running DOS (1983), the Apple Macintosh (1984), the AT&T Unix PC (1985), Atari ST (1986), SCO UNIX, OS/2, and Microsoft Windows (1989).

Article Info

Categories: Programming

Thanks to all authors for creating a page that has been read 2,033 times.

Did this article help you?
Yes No

Become
an Author!

Write an Article