GroupDocsGists
10/24/2017 - 1:26 PM

Examples1-GroupDocs.Annotation.CSharp-GroupDocs.AnnotationExamples-Annotations-AddTextAnnotationInCells.cs

// For complete examples and data files, please go to https://github.com/atirtahirgroupdocs/GroupDocs.Search-for-.NET
// Get input file stream
Stream inputFile = new FileStream(CommonUtilities.MapSourceFilePath(filePath), FileMode.Open, FileAccess.ReadWrite);

// Initialize list of AnnotationInfo
List<AnnotationInfo> annotations = new List<AnnotationInfo>();

// Initialize text annotation.
AnnotationInfo textAnnotation = new AnnotationInfo
{
    PageNumber = 1,
    AnnotationPosition = new Point(3, 3),
    FieldText = "Hello!"
};

// Add annotation to list
annotations.Add(textAnnotation);

// Export annotation and save output file
CommonUtilities.SaveOutputDocument(inputFile, annotations, DocumentType.Cells);