|
1 | 1 | using Syncfusion.DocIO; |
2 | 2 | using Syncfusion.DocIO.DLS; |
| 3 | +using Syncfusion.Drawing; |
3 | 4 | using System.IO; |
4 | 5 |
|
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)) |
6 | 19 | { |
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); |
34 | 22 | } |
| 23 | + |
0 commit comments