C# 将HTML转为Word
1、在VS程序中打开“解决方案资源管理器”,鼠标右键点击“引用”,“管理NuGet包”:

2、点击“搜索”,在搜索框中输入搜索内容,点击包,安装:

3、依次点击“OK”,"我接受",等待程序安装。

4、完成安装后,执行如下程序代码,将html转为Word:
using Spire.Doc;
namespace HTMLtoWord
{
class Program
{
static void Main(string[] args)
{
//创建 Document 对象
Document document = new Document();
//加载HTML文件
document.LoadFromFile("sample.html");
//将HTML文件转为Word并保存
document.SaveToFile("HtmltoWord.docx", FileFormat.Docx2013);
System.Diagnostics.Process.Start("HtmltoWord.docx");
}
}
}
声明:本网站引用、摘录或转载内容仅供网站访问者交流或参考,不代表本站立场,如存在版权或非法内容,请联系站长删除,联系邮箱:site.kefu@qq.com。
阅读量:54
阅读量:177
阅读量:81
阅读量:186
阅读量:73