var xml =
new XElement("Customer",
new XElement("Name", "John Doe"),
new XElement("Expiration", "2/1/2010"),
new XElement("AmountDue", "$129.50"));
var docxFile = @"..\..\doc.docx";
using (var wpd = WordprocessingDocument.Open(docxFile, true))
{
var mainPart = wpd.MainDocumentPart;
var xmlPart = mainPart.AddNewPart<CustomXmlPart>();
using (Stream partStream = xmlPart.GetStream(FileMode.Create, FileAccess.Write))
{
using (StreamWriter outputStream = new StreamWriter(partStream))
{
outputStream.Write(xml);
}
}