using (WordprocessingDocument package = WordprocessingDocument.Create(fileName, WordprocessingDocumentType.Document))
{
MainDocumentPart mainPart = package.AddMainDocumentPart();
using (Stream stream = mainPart.GetStream())
}
wml2 inner = wml2.CreateDocument();
CT_Document ct_doc = inner.document.Append();
CT_Body ct_body = ct_doc.body.Append();
CT_P ct_paragraph = ct_body.p.Append();
CT_R ct_run = ct_paragraph.r2.Append();
CT_Text ct_text = ct_run.t.Append();
ct_text.Value = "Manipulations autour du format WordML";
UTF8Encoding encoding = new UTF8Encoding();
byte[] array = encoding.GetBytes(inner.Node.InnerXml);
// Ecriture du fichier word/document.xml
stream.Write(array, 0, array.Length);
MainDocumentPart mainPart = package.MainDocumentPart;