With the help of Spire.Doc for .NET, developers can easily set bullet style for the existing word documents via invoke p.ListFormat.ApplyBulletStyle() method to format. This article will show you how to convert HTML list into word and set the bullet style for the word list in C#.
Firstly, please view the effective screenshot for the result word document:

Here comes to the steps:
Step 1: Create a new document and add a section to the document.
Document document = new Document(); Section section=document.AddSection();
Step 2: Add word list to the paragraph by appending HTML.
Paragraph paragraph = section.AddParagraph();
paragraph.AppendHTML("<ol><li>Version 1</li><li>Version 2</li><li>Version 3</li></ol>");
Step 3: Set the bullet style for the paragraph.
foreach (Paragraph p in section.Paragraphs)
{
p.ApplyStyle(BuiltinStyle.Heading2);
if (p.ListFormat.CurrentListLevel != null)
{
p.ListFormat.ApplyBulletStyle();
}
}
Step 4: Save the document to file
document.SaveToFile("result.docx",FileFormat.Docx);
Full codes:
// Create a new Word document object
Document document = new Document();
// Add a section to the document
Section section = document.AddSection();
// Add a paragraph to the section
Paragraph paragraph = section.AddParagraph();
// Append HTML content to the paragraph
paragraph.AppendHTML("- Version 1
- Version 2
- Version 3
");
// Loop through all paragraphs in the section
foreach (Paragraph p in section.Paragraphs)
{
// Apply "Heading 2" built-in style to the paragraph
p.ApplyStyle(BuiltinStyle.Heading2);
// Check if the paragraph has listformat
if (p.ListFormat.CurrentListLevel != null)
{
// Apply bullet style
p.ListFormat.ApplyBulletStyle();
}
}
// Save the document to a file in DOCX format
document.SaveToFile("result.docx", FileFormat.Docx);
// Dispose
document.Dispose();
