-
Notifications
You must be signed in to change notification settings - Fork 83
Expand file tree
/
Copy pathProgram.cs
More file actions
30 lines (26 loc) · 1.1 KB
/
Copy pathProgram.cs
File metadata and controls
30 lines (26 loc) · 1.1 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
using System.IO;
using SharpDocx;
namespace Tutorial
{
internal class Program
{
private static readonly string BasePath =
Path.GetDirectoryName(typeof(Program).Assembly.Location) + @"/../../../../..";
private static void Main()
{
var viewPath = $"{BasePath}/Views/Tutorial.cs.docx";
var documentPath = $"{BasePath}/Documents/Tutorial.docx";
var imageDirectory = $"{BasePath}/Images";
#if DEBUG
string documentViewer = null; // Try to find a document viewer automatically.
//var documentViewer = @"C:\Program Files\Microsoft Office\root\Office16\WINWORD.EXE"; // Or specify a document viewer manually.
Ide.Start(viewPath, documentPath, null, null, f => f.ImageDirectory = imageDirectory, documentViewer);
#else
DocumentBase document = DocumentFactory.Create(viewPath);
document.ImageDirectory = imageDirectory;
document.Generate(documentPath);
System.Console.WriteLine($"Succesfully generated {documentPath} using view {viewPath}.");
#endif
}
}
}