我正在寻找一个允许创建 Word 文档的 .NET 库。我需要将基于 HTML 的内容导出到 Word 文档(97-2003 格式,而非 docx)。
我知道有 Microsoft Office Automation 库和 Office interop,但据我所知,它们要求您实际安装了 office,并且它们通过打开 word 本身来进行转换。但我不想要求安装 office 才能进行转换。
编辑:如果可能的话,转换为 RTF 甚至可能有效。
最佳答案
如果我以某种方式将 CSS 转换为嵌入到 HTML 中,它会起作用吗?
是的。如前所述,我使用内部样式表。
文档示例:
<html>
<head>
<STYLE type="text/css">
h1 {text-align:center; font-size:12.0pt; font-family:Arial; font-weight:bold;}
p {margin:0in; margin-bottom:0pt; font-size: 10.0pt;font-family: Arial;}
p.Address {text-align:center;font-family:Times; margin-bottom: 10px;}
</style></head>
<body>
<p class="Address">The Street</p>
<h1>Head</h1>
关于c# - 在 C# 中导出到 Word 文档,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/282531/