I need to add a blank line/spacer between the last item of Level(1) and the next item in level(0) show that it looks like
attachment 2
I have tried may different type of inserts but all I do is screw up my output.
currently I get
attachment1
I need to add a blank line/spacer between the last item of Level(1) and the next item in level(0) show that it looks like
attachment 2
I have tried may different type of inserts but all I do is screw up my output.
currently I get
attachment1
Hi there,
Thanks for your inquiry. Please use the following code example to achieve your requirements. Hope this helps you.
Document doc = new Document(MyDir + "in.docx");
DocumentBuilder builder = new DocumentBuilder(doc);
NodeCollection paragraphs = doc.GetChildNodes(NodeType.Paragraph, true);
foreach (Paragraph para in paragraphs.ToArray())
{
if (para.IsListItem)
{
builder.MoveToParagraph(paragraphs.IndexOf(para), -1);
builder.Write(ControlChar.LineBreak);
}
}
doc.Save(MyDir + "Out.docx");
If the problem still remains, please attach your input Word document here for testing. I will investigate the issue on my side and provide you more information.
Does not give me exactly what I need and it may be because my structure is messed up a bit. I’ve attached my code which loops a datatable for level 0 items then loops a different datatable for level 1.
Add builder.Write(ControlChar.LineBreak) gives me is a level (0) with a blank line and then my text.
Thanks for your help
Hi there,
Thanks for your inquiry. As per my understanding, you want to insert the space between two list items. If this is the case, please use ParagraphFormat.SpaceAfter property to set the amount of spacing (in points) after the paragraph as shown in following code example.
If you still face problem, please share you input and expected output document here for our reference. Please manually create your expected Word document using Microsoft Word. We will investigate how you want your final Word output be generated like. We will then provide you more information on this along with code.
Document doc = new Document(MyDir + "in.docx");
DocumentBuilder builder = new DocumentBuilder(doc);
NodeCollection paragraphs = doc.GetChildNodes(NodeType.Paragraph, true);
foreach (Paragraph para in paragraphs.ToArray())
{
if (para.IsListItem)
{
para.ParagraphFormat.SpaceAfter = 10;
}
}
doc.Save(MyDir + "Out.docx");