static void Main(string[] args) { using (Package Docpackage = Package.Open("HelloWorld.docx")) { // Create the mail part PackagePart mainPart = Docpackage.CreatePart(new Uri("/document.xml", UriKind.Relative), "application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml"); // and the relationship Docpackage.CreateRelationship(mainPart.Uri, TargetMode.Internal,"http://.../officeDocument/2006/relationships/officeDocument"); // create the empty document XML using (XmlWriter writer = XmlWriter.Create(mainPart.GetStream(FileMode.CreateNew, FileAccess.ReadWrite))) { writer.WriteStartElement("w", "document", "http//.../wordprocessingml/2006/main"); writer.WriteEndElement(); } } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)