Skip to content

Commit 6919baf

Browse files
Merge pull request #578 from SyncfusionExamples/Bullet_Color
263778 - How to Change Bullet Color and Bullet Character in a Word Document Using .NET
2 parents 2930565 + 0a5746d commit 6919baf

1 file changed

Lines changed: 17 additions & 28 deletions

File tree

  • Paragraphs/Change-bullet-symbol-in-list/.NET/Change-bullet-symbol-in-list
Lines changed: 17 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,23 @@
11
using Syncfusion.DocIO;
22
using Syncfusion.DocIO.DLS;
3+
using Syncfusion.Drawing;
34
using System.IO;
45

5-
namespace Change_bullet_symbol_in_list
6+
FileStream inputStream = new FileStream(Path.GetFullPath(@"Data/Input.docx"), FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
7+
//Load the file stream into a Word document.
8+
WordDocument document = new WordDocument(inputStream, FormatType.Docx);
9+
//Access the list style in a Word document.
10+
ListStyle style = document.ListStyles[0];
11+
WListLevel levelOne = style.Levels[0];
12+
//Define the character and pattern for level 1.
13+
levelOne.PatternType = ListPatternType.Bullet;
14+
levelOne.BulletCharacter = "\u0076";
15+
levelOne.CharacterFormat.FontName = "Wingdings";
16+
levelOne.CharacterFormat.TextColor = Color.Red;
17+
//Create a file stream.
18+
using (FileStream outputFileStream = new FileStream(Path.GetFullPath(@"Output/Sample.docx"), FileMode.Create, FileAccess.ReadWrite))
619
{
7-
class Program
8-
{
9-
static void Main(string[] args)
10-
{
11-
//Open the file as a stream.
12-
using (FileStream inputStream = new FileStream(Path.GetFullPath(@"Data/Input.docx"), FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
13-
{
14-
//Load the file stream into a Word document.
15-
using (WordDocument document = new WordDocument(inputStream, FormatType.Docx))
16-
{
17-
//Access the list style in a Word document.
18-
ListStyle style = document.ListStyles[0];
19-
WListLevel levelOne = style.Levels[0];
20-
//Define the character and pattern for level 1.
21-
levelOne.PatternType = ListPatternType.Bullet;
22-
levelOne.BulletCharacter = "\u0076";
23-
levelOne.CharacterFormat.FontName = "Wingdings";
24-
//Create a file stream.
25-
using (FileStream outputFileStream = new FileStream(Path.GetFullPath(@"Output/Sample.docx"), FileMode.Create, FileAccess.ReadWrite))
26-
{
27-
//Save the Word document to the file stream.
28-
document.Save(outputFileStream, FormatType.Docx);
29-
}
30-
}
31-
}
32-
}
33-
}
20+
//Save the Word document to the file stream.
21+
document.Save(outputFileStream, FormatType.Docx);
3422
}
23+

0 commit comments

Comments
 (0)