-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
57 lines (48 loc) · 2.29 KB
/
Program.cs
File metadata and controls
57 lines (48 loc) · 2.29 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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
using System;
using System.Diagnostics;
using System.Globalization;
using Xceed.Words.NET;
namespace NoteGenerator {
class Program {
static void Main(string[] args) {
string name = "Aidan Lee";
string[] classes = {"Intermediate Spanish 1", "Digital Circuits & Systems", "High-Performance Computing"};
DateTime dt = DateTime.Now;
string date = dt.ToString("yyyy-MM-dd");
string displayDate = dt.ToString("M / d / yyyy");
Console.WriteLine($"Creating a new note for {name}...");
Console.Write("Title: ");
string title = Console.ReadLine();
TextInfo ti = new CultureInfo("en-US", false).TextInfo;
Console.WriteLine("\nClasses: ");
for(int i = 0; i < classes.Length; i++)
Console.WriteLine($"\t {i}: {classes[i]}");
Console.Write("Class: ");
string className = classes[Convert.ToInt32(Console.ReadLine())];
string fileName = $@"C:\Users\Aidan Lee\Google Drive\Trinity\Junior\{className}\{date} Notes.docx";
string body = "";
var doc = DocX.Create(fileName);
//Formatting Title
Formatting headerFormat = new Formatting();
//Specify font properties
headerFormat.FontFamily = new Font("Cambria");
headerFormat.Size = 12;
headerFormat.FontColor = System.Drawing.Color.Black;
//Insert text
doc.InsertParagraph(name, false, headerFormat);
doc.InsertParagraph(displayDate, false, headerFormat);
doc.InsertParagraph(className, false, headerFormat);
//Specify font properties
Formatting titleFormat = new Formatting();
titleFormat.FontFamily = new Font("Cambria");
titleFormat.Size = 12;
titleFormat.FontColor = System.Drawing.Color.Black;
titleFormat.UnderlineColor = System.Drawing.Color.Black;
Paragraph par = doc.InsertParagraph(ti.ToTitleCase(title), false, titleFormat);
par.Alignment = Alignment.center;
doc.InsertParagraph(body, false, headerFormat);
doc.Save();
Process.Start(fileName);
}
}
}