...

View Full Version : Javascript to export data from SQL to word



animelover72
12-10-2009, 04:15 AM
Hi,
is it possible to create a script which exports data from a SQL server into MS Word?

Philip M
12-10-2009, 08:46 AM
Hi,
is it possible to create a script which exports data from a SQL server into MS Word?

Nope. JavaScript is purely a client-side language, and unless used with an Ajax call has no capability to read from or write to a file (except a cookie), communicate with the server or access a database.


All advice is supplied packaged by intellectual weight, and not by volume. Contents may settle slightly in transit.

rnd me
12-10-2009, 09:21 PM
you could use ajax to fetch the data, and a dataURL to send it to word, but in all likelyhood, it's going to be simpler to do it all on the server.

Keep in mind that if you serve an HTML page with a word mimetype, the page open in word and acts like a document...

Old Pedant
12-11-2009, 01:05 AM
Well, technically, you *CAN* write a script to do exactly what he asked for.

You just create a ".js" file and execute it via the Windows Script Host.

Has nothing whatsoever to do with a browers or HTML. Has to be done from the windows command line or equivalent.

But even doing it that way it's a really tough thing to do. You have to treat MS Word as an ActiveX object and you have to use all the internal objects of MS Word with all of their thousands and thousands of obscure and poorly documented methods.

So the answer to "is it possible" is actually "yes."

But probably not the way you would want it to be.

animelover72
12-11-2009, 04:50 AM
Ok.

It seems more trouble than its worth if thats the case.

Thanks guys.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum