Numbered List

Hey guys,

I want to creat a numbered list which contains a line of text without a number in front. This line has to be intended. I attatched a picture showing what I mean.

I’m not able to creat a document which looks like that using Aspose.Words. In Microsoft Word I just start a new numbered list, write my text and press Shift+Enter. Then I can enter the text as I want.

Could you provide me a code example?

Best Regards
Jan

Hello
Thanks for your request. Please try using the following code:

Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
// Create list.
List list = doc.getLists().add(ListTemplate.NUMBER_DEFAULT);
// Assign list to the first paragraph.
builder.getCurrentParagraph().getListFormat().setList(list);
builder.write("First Element");
builder.insertBreak(BreakType.LINE_BREAK);
builder.writeln("After First");
// Insert the second item.
builder.write("Second Element");
doc.save("C:\\Temp\\out.doc");

Best regards,

Hey Andrey,

thanks for the example you posted.
I was able to resolve my problem.

Thanks a lot!

Best regards,
Jan

Hi Jan,

It is perfect, that you already found solution. Please let me know in case of any issues. I will be glad to help you.
Best regards,