Hi,
In the attached document, a very large number of empty entries appear when I right-click the content. How do I remove these entries?
test.zip (32.8 KB)
Kind regards,
Hi,
In the attached document, a very large number of empty entries appear when I right-click the content. How do I remove these entries?
test.zip (32.8 KB)
Kind regards,
To remove empty entries from the right-click context menu in your Word document using the Aspose.Words library, you can focus on eliminating empty paragraphs, headers, or footers. The following C# code snippet demonstrates how to remove empty paragraphs:
// Load the document
Document doc = new Document("input.docx");
// Iterate through all paragraphs in the document
foreach (Paragraph paragraph in doc.GetChildNodes(NodeType.Paragraph, true))
{
// Check if the paragraph is empty
if (string.IsNullOrWhiteSpace(paragraph.GetText().Trim()))
{
// Remove the empty paragraph
paragraph.Remove();
}
}
// Save the modified document
doc.Save("output.docx");
Replace "input.docx"
with the path to your document. This code will effectively remove all empty paragraphs, which may help in cleaning up the right-click context menu.
If you also need to address empty headers or footers, please specify, and I can provide additional guidance on that.
@Nachti Unfortunately, there is no public API to customize the attached toolbars in the document.
We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.
Issue ID(s): WORDSNET-28675
You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.