Hakuna Matata
Hakuna Matata

Reputation: 1397

Convert word document to xml code c#

How to convert that word document to xml code like below? I have a word document template. After converting word document to xml code, i will append my data table to body tag and generate word document. Please help. In my application,There is no posibility using Interop or some other dlls to customize the document, so i am trying like this.

<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>

Upvotes: 2

Views: 3186

Answers (1)

Lantos Dumonch&#233;
Lantos Dumonch&#233;

Reputation: 61

OpenXML SDK 2.5

Allows you to manipulate Office files. The SDK is a bit unclear, though.

Some help on converting Office files to XML

Upvotes: 2

Related Questions