我想使用 docx 库创建一个文档 (*.docx)。我有来自富文本编辑器的 HTML 格式文本,我想按原样保存它。我找不到任何可以得到帮助的地方。我当前的代码非常基本,并且是从那里复制粘贴的帮助。
我的代码如下所示:
private string CreateDocumentFromText()
{
string filePath= Server.MapPath("../DocXExample.docx");
var document = Novacode.DocX.Create(filePath);
document.InsertParagraph("<b>Test</b>");
document.Save();
return fileName;
}
文档的内容为:
<b>Test</b>
而我希望它是:
测试