-
Notifications
You must be signed in to change notification settings - Fork 56
Expand file tree
/
Copy pathProgram.cs
More file actions
37 lines (36 loc) · 1.47 KB
/
Program.cs
File metadata and controls
37 lines (36 loc) · 1.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
using Syncfusion.DocIO;
using Syncfusion.DocIO.DLS;
using Syncfusion.Office;
namespace Create_ink
{
class Program
{
static void Main(string[] args)
{
using (FileStream fileStreamPath = new FileStream(Path.GetFullPath(@"Data/Template.docx"), FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
{
//Creates a new Word document.
using (WordDocument document = new WordDocument(fileStreamPath, FormatType.Docx))
{
//Get the ink paragraph of the document.
WParagraph paragraph = document.Sections[0].Paragraphs[0];
//Iterates through the child elements of ink paragraph.
for (int i = 0; i < paragraph.ChildEntities.Count; i++)
{
//Removes the ink from the paragraph.
if (paragraph.ChildEntities[i] is WInk)
{
paragraph.Items.RemoveAt(i);
i--;
}
}
using (FileStream outputFileStream = new FileStream(Path.GetFullPath(@"Output/Result.docx"), FileMode.Create, FileAccess.ReadWrite))
{
//Saves the Word document to file stream.
document.Save(outputFileStream, FormatType.Docx);
}
}
}
}
}
}