using System;
using System.Windows.Forms;
using Novacode;
using System.Diagnostics;
namespace doc
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
string fileName = @"d:\DocXExample.docx";
// Create a document in memory:
var doc = DocX.Create(fileName);
// Insert a paragrpah:
doc.InsertParagraph("This is my first paragraph");
// Save to the output directory:
doc.Save();
// Open in Word:
Process.Start("WINWORD.EXE", fileName);
}
}
}