Hi,
Could you tell me how to set no space between paragraph?
I have a scenario that I have take out the space between 2 paragraph and set them 1 space.
For example: paragraph 1 and paragraph 2 have 3 space … I want to remove the 2 spaces.
Could you send to me a sample code?
Best,
Tan Quan
Hi
Thanks for your inquiry. I think that you can try using the following code.
Document doc = new Document(@"276_106424_tanquan\in.doc");
ArrayList list = new ArrayList();
NodeCollection collection = doc.GetChildNodes(NodeType.Paragraph, true);
foreach (Paragraph pararagraph in collection)
{
Node node = pararagraph.NextSibling;
if (node != null && node.ToTxt() == "\r\n")
{
node = node.NextSibling;
while (node != null && node.ToTxt() == "\r\n")
{
if (!list.Contains(node))
list.Add(node);
else
break;
node = node.NextSibling;
}
}
}
foreach (Node node in list)
{
node.Remove();
}
doc.Save(@"276_106424_tanquan\out.doc");
I hope that this will help you.
Best regards.