Create a bullet list in Word using C#

  Kiến thức lập trình

I am trying to create a bullet list in Word over a series of paragraphs using C#. Reading up on this it looks like I have to create a ‘Range’ from the first paragraph to the last paragraph I want in the list and then apply a list template to the range. My current code is:

var ListRange = Document.Range(FirstParagraph.Range.Start, LastParagraph.Range.End);

var Gallery = Document.Application.ListGalleries[WdListGalleryType.wdBulletGallery];

ListRange.ListFormat.ApplyListTemplate(Gallery.ListTemplates[1], WdListApplyTo.wdListApplyToWholeList);

The paragraphs I want in the range appear OK but they are not in a bullet list. Any idea what I am doing wrong.

Thanks.

Theme wordpress giá rẻ Theme wordpress giá rẻ Thiết kế website

LEAVE A COMMENT