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