This project has moved. For the latest updates, please go here.

insert bullet list inside specific paragraph

Jan 26, 2016 at 4:44 PM
I'm working in a document, I need to add a bullet list in for loop, but the InsertList method insert the list at the end of my document, I need to insert that list in a specific paragraph.
Here's the code:
for (int i = 1; i <= d.Count; i++)
            {
                Paragraph p = g_document.InsertParagraph();
                
                CustomProperty cp0 = new CustomProperty("nombre_demandado" + i.ToString(), string.Empty);
                CustomProperty cp1 = new CustomProperty("nombre_provincia" + i.ToString(), string.Empty);
                CustomProperty cp2 = new CustomProperty("nombre_canton" + i.ToString(), string.Empty);
                CustomProperty cp3 = new CustomProperty("nombre_distrito" + i.ToString(), string.Empty);
                CustomProperty cp4 = new CustomProperty("direccion_deudor" + i.ToString(), string.Empty);
                CustomProperty cp5 = new CustomProperty("cedula_deudor" + i.ToString(), string.Empty);

                p.InsertDocProperty(cp0);
                p.InsertDocProperty(cp1);
                p.InsertDocProperty(cp2);
                p.InsertDocProperty(cp3);
                p.InsertDocProperty(cp4);
                p.InsertDocProperty(cp5);

                var bulletedList = g_document.AddList("", 0, ListItemType.Bulleted);
                g_document.InsertList(bulletedList);

                g_document.AddCustomProperty(new CustomProperty("nombre_demandado" + i.ToString(), ""));
                g_document.AddCustomProperty(new CustomProperty("nombre_provincia" + i.ToString(), ""));
                g_document.AddCustomProperty(new CustomProperty("nombre_canton" + i.ToString(), ""));
                g_document.AddCustomProperty(new CustomProperty("nombre_distrito" + i.ToString(), ""));
                g_document.AddCustomProperty(new CustomProperty("direccion_deudor" + i.ToString(), ""));
                g_document.AddCustomProperty(new CustomProperty("cedula_deudor" + i.ToString(), ""));
                p.InsertText("\n", false);

                llp.InsertParagraphAfterSelf(p);
            }
           
            g_document.SaveAs("test.docx");