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

Free Support Forum - aspose.com

Get ListTemplate from a List


When creating a new List, we must add a parameter, in order to specify which ListTemplate is used to create a List. I would like to do the reverse operation : from an existing List, to get the ListTemplate it uses.

If such an operation is not possible, how can I do to obtain for each level of the list the bullet used ?

Thank you very much

Hi Jean-Pascal,

Thanks for your inquiry. I would suggest you please read the following article on Lists in Aspose.Words:

A list in a MS Word document is a set of list formatting properties. The formatting of the lists is stored in the ListCollection separately from the paragraphs of text. You can use DocumentBase.getLists property to access the list formatting used in the document.

Please use the following code snippet to get the existing list in the document and set it for some other paragraphs. I have attached the input and output documents with this post.

Document doc = new Document(MyDir + "Test37.docx");

// Get First Paragraph
Paragraph para = (Paragraph)doc.getChild(NodeType.PARAGRAPH, 0, true);
DocumentBuilder builder = new DocumentBuilder(doc);
if (para.isListItem())
    for (int i = 0; i < 9; i++)
        builder.writeln("List Item " + i);
doc.save(MyDir + "AsposeOut.docx");

Please let us know if you need more information, we are always glad to help you.

Thanks for your answer but I still don’t understand how to get the ListTemplate constant when reading a document.

For example, let’ s say I have a document with ListTemplate.NUMBER_ARABIC_DOT list. When parsing this document with Aspose Word I would like to retrieve this information.

Is there some way to do that for example something like :

ListTemplate listTemplate = doc.getLists().get(0).getListTemplate();
ListTemplate listTemplate = doc.getLists().get(0).getListLevels().get(0).getListTemplate();

Best Regards,
Jean Pascal

Hi Jean-Pascal,

Thanks for your inquiry. Unfortunately, Aspose.Words does not support the requested feature at the moment. However, I have logged this feature request as WORDSNET-7562 in our issue tracking system. You will be notified via this forum thread once this feature is available.

We apologize for your inconvenience.

Thank you for the answer.
Do you know approximately when will this feature be supported ?

Best regards
Jean Pascal

Hi Jean-Pascal,

Thanks for your inquiry. Currently, this feature is pending for analysis and is in the queue. I am afraid, I cannot provide you any reliable estimate at the moment. Once this feature is analyzed, we will then be able to provide you an estimate.

We appreciate your patience.

A post was split to a new topic: How to get ListTemplate from the list