Extra Line spaces written after few tags

Hi,

Below is the code we have used to Tag insertion.

MbookmarkList = doc.Range.Bookmarks.Where(x => x.Name.StartsWith(MandTags[mi].TagPlaceholder + "RemoveTag")).ToList();
for (int j = 2; j <= MbookmarkList.Count(); j++)
{
    string temp = MbookmarkList[j - 1].Name;
    Bookmark bookmark = doc.Range.Bookmarks[temp];
    bookmark.Text = "";
}

from the above may i please know the use of bookmark.text="",Because when we use this we are getting Extra line space after the end tag as below.

@NanthiniSenthil123 Most likely, you should also remove paragraph that contains the bookmark. Please try modifying your code like this:

MbookmarkList = doc.Range.Bookmarks.Where(x => x.Name.StartsWith(MandTags[mi].TagPlaceholder + "RemoveTag")).ToList();
for (int j = 2; j <= MbookmarkList.Count(); j++)
{
    string temp = MbookmarkList[j - 1].Name;
    Bookmark bookmark = doc.Range.Bookmarks[temp];
    bookmark.Text = "";

    // Get parant paragraph of the bookmark and remove if it does not have content.
    Paragraph p = bookmark.BookmarkStart.GetAncestor(NodeType.Paragraph) as Paragraph;
    if (p != null && String.IsNullOrEmpty(p.ToString(SaveFormat.Text).Trim()))
        p.Remove();
}

If the problem still persist, please attach your document here for testing. We will check the issue and provide you more information.