We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Bullet List not closed

We have a word document ending with bullet text list. When we append a “Disclaimer Text” to the end of the document, this text gets into the bullet list which is not what we want. I am using the DocumentBuilder.InsertHtml method call. (Aspose.Words.dll v13.4.0.0)

Hi Letao,

Thanks for your inquiry. It would be great if you please share following detail for investigation purposes.

  • Please attach your input Word document.
  • Please

create a standalone/runnable simple application (for example a Console
Application Project
) that demonstrates the code (Aspose.Words code) you used to generate
your output document

  • Please attach the output Word file that shows the undesired behavior.
  • Please
    attach your target Word document showing the desired behavior.

it is difficult to say what the problem is without the Document(s) and
simplified application. We need your Document(s) and simple project to
reproduce the problem. As soon as you get these pieces of information to
us we’ll start our investigation into your issue.

Hello Tahir,
I just posted the source code for adding a line of “disclaimer text” to the word document, with attachment of test files.
The TestSample.doc is the original document ending with bullet text list;
The D_TestSample.doc is the result, notice the problem that the line was added into the bullet list;
The D_TestSample_Expected.doc is what we want it to look like.
Thank you very much!

Hi Letao,

Thanks for sharing the detail. In your case, I suggest you please move the cursor to the end of document using DocumentBuilder.MoveToDocumentEnd method and use the ListFormat.RemoveNumbers method to remove numbers or bullets from the current paragraph and sets list level to zero.

Please check the following code example for your kind reference. Hope this helps you. Please let us know if you have any more queries.

Document doc = new Document(MyDir + "TestSample.doc");
DocumentBuilder builder = new DocumentBuilder(doc);

builder.Writeln("This is the Disclaimer Text");
doc.Save(MyDir + "Out.docx");

Hi Tahir,
Thank you very much for your quick reply and suggested solution. It helps.
I have included it in our code, with checking the documentBuilder.ListFormat.IsListItems property.
If you can point me to some online material to get more familiar with the Aspose object model, I’d appeciate!

Hi Letao,

Thanks for your inquiry.

Please note that Aspose.Words is quite
different from the Microsoft Word’s Object Model in that it represents
the document as a tree of objects more like an XML DOM tree. If
you worked with any XML DOM library you will find it is easy to
understand and work with Aspose.Words. When you load a Word document
into Aspose.Words, it builds its DOM and all document elements and
formatting are simply loaded into memory. Please read the following
articles for more information on DOM:

Please let us know if you have any more queries.