Exemplo n.º 1
0
        private static void SaveDocX(Body body, String docName)
        {
            // Create a Wordprocessing document.
            using (WordprocessingDocument package = WordprocessingDocument.Create(docName, WordprocessingDocumentType.Document))
            {
                package.AddMainDocumentPart();
                package.MainDocumentPart.Document = new Document();

                StyleDefinitionsPart styleDefinitionsPart1 = package.MainDocumentPart.AddNewPart <StyleDefinitionsPart>("rId1");
                MD2OXMLFile          file = new MD2OXMLFile();
                file.GenerateStyleDefinitionsPart1Content(styleDefinitionsPart1);

                package.MainDocumentPart.Document.AppendChild(body);
                package.MainDocumentPart.Document.Save();
            }
        }
        private static void SaveDocX(Body body, String docName)
        {
            // Create a Wordprocessing document.
            StyleDefinitionsPart styleDefinitionsPart1 = package.MainDocumentPart.AddNewPart<StyleDefinitionsPart>("rId1");
            MD2OXMLFile file = new MD2OXMLFile();
            file.GenerateStyleDefinitionsPart1Content(styleDefinitionsPart1);

            package.MainDocumentPart.Document.AppendChild(body);
            package.MainDocumentPart.Document.Save();
            package.Dispose();
        }