将word文档转换为xml代码c#

时间:2014-10-30 12:16:18

标签: c# asp.net xml

如何将该word文档转换为xml代码,如下所示? 我有一个word文档模板。将word文档转换为xml代码后,我会将我的数据表附加到body标签并生成word文档。请帮忙。 在我的应用程序中,没有可能使用Interop或其他一些dll来自定义文档,所以我想这样。

<html xmlns:o='urn:schemas-microsoft-com:office:office' 
xmlns:w='urn:schemas-microsoft-com:office:word'
xmlns='http://www.w3.org/TR/REC-html40'>
<head><title>Time</title>
<!--[if gte mso 9]>
<xml>
<w:WordDocument>
<w:View>Print</w:View>
<w:Zoom>90</w:Zoom>
<w:DoNotOptimizeForBrowser/>
</w:WordDocument>
</xml>
<![endif]-->
<style>
<!-- /* Style Definitions */
@page Section1   
{size:8.5in 11.0in;    
margin:1.0in 1.25in 1.0in 1.25in ;    
mso-header-margin:.5in;    
mso-footer-margin:.5in; 
mso-paper-source:0;
} 
div.Section1   {page:Section1;}
-->
</style>
</head>
<body lang=EN-US style='tab-interval:.5in'>
<div class=Section1><h1>Time and tide wait for none</h1>
<p style='color:red'><I>10/30/2014 5:37:16 PM</I></p>
</div>
</body>
</html>

1 个答案:

答案 0 :(得分:1)

OpenXML SDK 2.5

允许您操作Office文件。但是,SDK有点不清楚。

Some help on converting Office files to XML

相关问题