OpenXml SDK 2.0 创建Word文档——最简化的版本

 
            using (WordprocessingDocument objWordDocument = WordprocessingDocument.Create(@"C:\********.docx", WordprocessingDocumentType.Document))
            {
                MainDocumentPart objMainDocumentPart = objWordDocument.AddMainDocumentPart();
                Document objDocument = new Document();
                Body objBody = new Body();
                objDocument.Append(objBody);
                objMainDocumentPart.Document = objDocument;
            }

你可能感兴趣的:(word)