When we are generating a document using Aspose.Words in the post callback method we are checking whether the list item is empty. If the list item is empty we are deleting that number.
The logic that we have used is:
if (para.IsListItem && string.IsNullOrWhiteSpace(para.GetText().Trim().IgnoreChars()))
{
if (para.ParentNode is Cell parentCell && !string.IsNullOrWhiteSpace(parentCell.ParentRow.GetText().Trim().IgnoreChars()))
{
continue;
}
para.Remove();
}
However, our code is failing for some of the scenarios such as hanging bullet points, where we are starting the text from next line.
For eg:
What is the best way to check whether is list item is really empty.
How can we make sure in post callback that we are only deleting those bullet points which are empty?