c# html 转Word--Spire.Doc

利用 Spire.Doc 组件,NuGet搜索“FreeSpire.Doc”有个免费版.

 

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System;
using Spire.Doc;
using Spire.Doc.Documents;
using System.IO;

public static void htmltoWord(string sFile)
{
//sFile = @"E:\work\documents\TestSample.html";
//Load Document
Document document = new Document();
TextReader r = File.OpenText(sFile);
document.LoadHTML(r,XHTMLValidationType.None);
//Convert Word to PDF
document.SaveToFile("toDoc.doc", FileFormat.Docx);
//Launch Document
System.Diagnostics.Process.Start("toDoc.doc");
}

 

 

 

更多官方参考:https://www.e-iceblue.com/Introduce/word-for-net-introduce/Demo.html#.XP-2Nnot0dU

 

上一篇:Spire.Doc for Java Crack Version-新版


下一篇:Java 添加、回复、修改(替换)、删除Word批注