Search code examples
c#htmlc#-4.0openxmlopenxml-sdk

How to convert html string into OOXML (Word 2007) formatted string using openxmlsdk 2.0?


I have a string in HTML format (it may contains HTML tables). Now I want to convert this html string into OOXML representation of Word 2007 based string and store it into my DB table. In future, once I have collected all the html strings then I have to build the Word document from the OOXML string that are stored in the DB.

So, now my problem is I have to convert my html string into equivalent OOXML formatted string for Word 2007.

I already tried with AlternativeFormatImportPart class in openxmlsdk2.0.But it is directly build the Word document for the given html string. I don't want to do it. I just want to convert from HTML string to OOXML formatted string of Word 2007.


Solution

  • If you mean you want to convert HTML code to OpenXML code (elements), you cannot do it directly. Either write your own converter or use one of the available ones (not a lot of amazing ones though that are actively supported). Here is one. http://html2openxml.codeplex.com/