Squiggly underlines are normally used to show inconsistencies in the document. We are quite familiar with these lines as Microsoft Word uses red squiggly underlines to indicate spelling mistakes and blue squiggly/wavy underlines for formatting issues. We can also add such underline annotations in documents programmatically. In this article, we will learn how to add wavy underlines in Word, PDF, PPT, and other documents using C#.
The following topics are discussed below:
- .NET API for Wavy Underline / Squiggly Annotation
- Add Wavy Underline to Text in Word Documents – Squiggly Annotation
- Add Wavy Underline to Text in PDF, PPT, and other Documents
.NET API for Wavy Underline – Squiggly Annotation
GroupDocs.Annotation provides the annotation solution that allows manipulation and automation of various annotation types in documents within .NET applications. We will use its GroupDocs.Annotation for .NET API to add a squiggly annotation in documents using C#.
PM> Install-Package GroupDocs.Annotation
Add Wavy Underline to Text in Word (DOC/DOCX) using C# – Squiggly Annotation
The following step shows how to insert a wavy underline in a Word document using C#.
- Load the Word (DOC, DOCX) using the Annotator class.
- Create the wavy underline using the SquigglyAnnotation class.
- Personalize the squiggly underline by setting its color, opacity, coordinates, page number, etc.
- Add the squiggly annotation to the annotator.
- Save the updated Word file using Save() method.
The following C# code example adds the wavy underline to the selected text of the Word document.
You can add any other annotation type from various AnnotationModels.
Add Wavy Underline to Text in PDF, PPT, and Other Documents using C#
Similarly, you can add the squiggly underline to any document using the same C# code (Check the documentation if your intended document file format is supported by the API).
The following are the steps for how to insert a wavy underline in a PDF document using C#.
- Load the PDF document using the Annotator class.
- Create the squiggly underline using the SquigglyAnnotation class.
- Customize the color, opacity, coordinates, page number, etc for the squiggly/wavy underline.
- Add the squiggly annotation to the annotator using Add() method.
- Save the updated PDF file using Save() method.
The following C# code example adds the wavy underline to the selected text of the PDF file.
To sum up, we discussed how to add wavy/squiggly underline in Word documents using C#. Additionally, the same squiggly annotation can be added to other documents like PDF, PPT, and more. Squiggly annotation is a new addition to many other annotation types offered by the API.
Learn more about GroupDocs.Annotation for .NET. Visit its documentation to start building your own document annotation applications for various supported document formats. For queries, contact us via the forum.