Help needed removing bullet pictures from document

Hi,

I’m running the latest release of Aspose.Words .NET via Mono in a Linux environment. Unfortunately GDI+ in Mono is far from fully implemented and I get some serious issues with it being unable to handle images - luckily I don’t need image support for the work I am doing right now.

I found some example code in the forum for how to pull out all Shape nodes and remove them from the document before saving. This works fine for everything except pictures used as bullets in list items. These are not returned by Document.GetChildNodes( NodeType.Shape) and thus can’t be deleted using the same code.

Does anyone have a simple code example for pulling out the Shape (or whatever they are) nodes being used in picture bullets?

Regards,
Mark.

Hi

Thanks for your inquiry. I think, you can just reset all bullets to default, in your case. Please see the following code:

// open document.
Document doc = new Document(@"Test001\in.doc");
// Get collection of paragraphs in the document.
NodeCollection paragraphs = doc.GetChildNodes(NodeType.Paragraph, true);
// Loop through all paragrpahs.
foreach(Paragraph paragraph in paragraphs)
{
    // Check if th ecurrent paragraph is list item.
    if (paragraph.IsListItem && paragraph.ListFormat.ListLevel.NumberStyle == NumberStyle.Bullet)
    {
        // Reset bullets to default, preserving list level.
        int listLevel = paragraph.ListFormat.ListLevelNumber;
        paragraph.ListFormat.ApplyBulletDefault();
        paragraph.ListFormat.ListLevelNumber = listLevel;
    }
}
// Save output document.
doc.Save(@"Test001\out.doc");

Hope this helps.
Best regards.

Hi,

Yes, worked perfectly!

Thanks,
Mark.