SQLTeam.com | Weblogs | Forums

Export Data into Doc Format


Hi Expert,

I have one column EmpDetail Varchar(max) name and it is store data into HTML data (resume of user).

There are 1000 records are store into EmpDetail column.

Now I want to export that each record in word format in a folder and keep seprate record wise.

Please help.


Just export it as an HTML file instead of trying to convert it to Word. I'm pretty sure that word will open an HTML document.


Yes but it is showing like this :

CATERINA PAPALIA<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />



<P class=MsoNormal style="MARGIN


Did you just try opening it as an XML file or a text file?


I'm trying to open in docx.

Is there any sql script / Function / Tool to convert them in docx.

I need to convert more than 1 lakhs records.


I don't do this sort of thing. I suspect your best friend will be "Yabingooglehoo" at this point. Search for "CONVERT HTML TO WORD".


The issue here, as I see it, is that SQL will not parse HTML and without that you cannot safely remove TAGs - which may be nested, or "broken" and all sorts ...

... use something outside SQL to remove the TAGs, which probably needs to be something that can parse HTML / XML and create a proper TREE which it can then clean up.

RegEx solutions etc. just plain don't work IME.

I have seen tools in Cut & Paste data-entry boxes on web forms that offer a "Word Cleanup Content after Paste", they would be Javascript I suppose, but maybe something from those stables offers a solution?