Hi,
I need to delete all recurrences of the text shown below(including the paragraph break at the end) from a document:
Blank line to be deleted^q
Attached a zip file contains an input and output sample files:
PragraphBreak.zip (20.4 KB)
Can someone help please?
@saleh.noures,
You can meet this requirement by using the following code of Aspose.Words for .NET:
Document doc = new Document("E:\\Temp\\PragraphBreak\\Input.docx");
ArrayList list = new ArrayList();
foreach (Paragraph para in doc.GetChildNodes(NodeType.Paragraph, true))
{
if (para.ToString(SaveFormat.Text).Trim().Contains("***Blank line to be deleted***"))
{
list.Add(para);
}
}
for (int i = 0; i < list.Count; i++)
((Paragraph)list[i]).Remove();
doc.Save("E:\\Temp\\PragraphBreak\\19.12.docx");