在C#中导出到Word文档

Ada*_*ile 4 c# export ms-word

我正在寻找一个允许创建Word文档的.NET库.我需要将基于HTML的内容导出到Word文档(97-2003格式,而不是docx).

我知道有Microsoft Office Automation库和Office互操作,但据我所知,它们要求您实际安装了办公室,并且他们通过打开单词本身进行转换.但我不希望安装办公室以便转​​换工作.

编辑:如果可能,转换为RTF甚至可以工作.

Fio*_*ala 6

如果我以某种方式将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>
Run Code Online (Sandbox Code Playgroud)