C# FreeSpire.Doc 操作word文档

C# FreeSpire.Doc

免费的word文档类库

环境准备

Nuget安装

  • FreeSpire.Doc

引用

using Spire.Doc;
using Spire.Doc.Documents;
using System.IO;

Html转换为word文档

static void GetHtmlDocument() {
            Document doc = new Document();
            TextReader reader = new StringReader("<html><head></head><body><div>HelloWorld</div></body></html>");
            doc.LoadHTML(reader, XHTMLValidationType.None);           
            doc.SaveToFile("test1.doc");
}
原文地址:https://www.cnblogs.com/tangpeng97/p/14468537.html