Independentsoft
Professional software libraries for developers
Home
Purchase
Support
Company
Contact
ODF .NET
>
Tutorial
> Add annotation
The following example shows how to add an annotation (comment) to a paragraph.
C# example
using System; using Independentsoft.Office.Odf; namespace Sample { class Program { static void Main(string[] args) { TextDocument doc = new TextDocument(); Paragraph commentBody = new Paragraph(); commentBody.Add("This is a reviewer comment."); Annotation annotation = new Annotation(); annotation.Creator = "Jane Smith"; annotation.CreationDate = new DateTime(2026, 1, 15); annotation.Show = true; annotation.Add(commentBody); Paragraph p1 = new Paragraph(); p1.Add("This text has an annotation"); p1.Add(annotation); p1.Add(" attached to it."); doc.Body.Add(p1); doc.Save("c:\\test\\output.odt", true); } } }
VB example
Imports System Imports Independentsoft.Office.Odf Module Module1 Sub Main(ByVal args() As String) Dim doc As TextDocument = New TextDocument Dim commentBody As Paragraph = New Paragraph commentBody.Add("This is a reviewer comment.") Dim annotation As Annotation = New Annotation annotation.Creator = "Jane Smith" annotation.CreationDate = New DateTime(2026, 1, 15) annotation.Show = True annotation.Add(commentBody) Dim p1 As Paragraph = New Paragraph p1.Add("This text has an annotation") p1.Add(annotation) p1.Add(" attached to it.") doc.Body.Add(p1) doc.Save("c:\test\output.odt", True) End Sub End Module
Need help? Ask our developers:
Name*
Email*
Message*