public static void GenerateSurprise(dynamic context) { string xml = File.ReadAllText("Demo.xml"); RazorEngine engine = new RazorEngine(); TemplateBase template = engine.GenerateTemplateClass(xml); template.Context = context; string output = engine.GetOutput(template); File.WriteAllText("DemoOutput.xml", output); Word.Application app = new Application(); app.Visible = true; // Open the document that was chosen by the dialog Word.Document doc = app.Documents.Open(Path.Combine(Environment.CurrentDirectory, "DemoOutput.xml")); // Activate the document so it shows up in front doc.Activate(); }
public Form1() { InitializeComponent(); Engine = new RazorEngine(); }