Hi Team,
How to remove all paragraphs from word page except Shapes or Images.
I just want to keep only images or shapes in word page and remove all other paragraphs or text.
Hi Team,
How to remove all paragraphs from word page except Shapes or Images.
I just want to keep only images or shapes in word page and remove all other paragraphs or text.
Generally, you can use the following Aspose.Words code to remove all paragraphs from Word document except the Shapes or Images:
Document doc = new Document("E:\\Temp\\in.docx");
foreach(Paragraph para in doc.GetChildNodes(NodeType.Paragraph, true))
{
if (para.GetChildNodes(NodeType.Shape, true).Count == 0)
{
para.Remove();
}
}
doc.Save("E:\\Temp\\19.11.docx");
In case the problem still remains, please ZIP and attach the following resources here for testing:
As soon as you get these pieces of information ready, we will start further investigation into your issue and provide you code to achieve the same by using Aspose.Words. Thanks for your cooperation.