Remove annotation from document

View as MarkdownMarkdown

Set up your AI agent

Give your coding agent live access to the GroupDocs documentation and API reference through the GroupDocs Docs MCP server — no install, no API key. Learn more

claude mcp add --transport http groupdocs-docs https://docs.groupdocs.com/mcp

Also process documents locally

The GroupDocs.Annotation MCP server lets your agent work with files on your machine; they are never uploaded. It needs the .NET 10 SDK or Docker.

claude mcp add groupdocs-annotation -- dnx GroupDocs.Annotation.Mcp --yes
Folders, licensing and more →

GroupDocs.Annotation allows you to remove all previously added annotations. To do this, follow these steps:

  1. Instantiate the Annotator class. Specify the input document path or stream.
  2. Instantiate the SaveOptions class. Set AnnotationTypes = AnnotationType.None.
  3. Call the Save method. Specify the output document path or stream.

Remove annotation using its index

The following code snippet shows how to remove annotation using its index:

using (Annotator annotator = new Annotator("result.xlsx"))
{
	annotator.Remove(0);
	annotator.Save("removed.xlsx");
}

Remove annotation using the object

The following code snippet shows how to remove annotation using the object:

using (Annotator annotator = new Annotator("result.xlsx"))
{
	var tmp = annotator.Get();
	annotator.Remove(tmp[0]);
	annotator.Save("removed.xlsx");
}

Remove annotations using the list of indexes

The following code snippet shows how to remove annotations using list of indexes:

using (Annotator annotator = new Annotator("result.xlsx"))
{
	var idList = new List<int>{1, 2, 3};
	annotator.Remove(idList);
	annotator.Save("removed.xlsx");
}

Remove annotations using the list of objects

The following code snippet shows how to remove some annotations from document using list of objects:

using (Annotator annotator = new Annotator("result.xlsx"))
{
	var tmp = annotator.Get();
	annotator.Remove(tmp);
	annotator.Save("removed.xlsx");
}