[Javascript] Client-side Word document creation via XML/XSLT

Terry Riegel riegel at clearimageonline.com
Sun Mar 21 20:50:07 CDT 2010


This looks like what you are looking for...

http://en.m.wikipedia.org/wiki/Data_URI_scheme

Looks like you can do it with ff/safari/chrome but ie seems limited to  
jpegs.

Terry

http://p8ste.com

On Mar 21, 2010, at 8:05 PM, Dave Shaw <dshaw256 at centurylink.net> wrote:

> This is going to be a bit long. Please bear with me.
>
> I have a package called the Data Integration Toolkit (DIT) by  
> CorasWorks
> in one of my SharePoint environments. I can use this to fetch data in
> XML format from nearly anywhere, including native SharePoint content,
> then apply XSLT transforms against it for display on SharePoint web  
> part
> pages. I've gotten some very nice custom displays from this. I've
> managed to also use the DIT to apply an XSLT template with WordML  
> markup
> to get SharePoint list content in a nicely-formatted Word document in
> Word 2003 XML format.
>
> I support another SharePoint environment that does not have the DIT
> available. I'd like to accomplish some of these same things in that
> environment. I figure I should be able to do all this client side.  
> I've
> managed to get the SharePoint list content in XML format (owssvr.dll  
> is
> your friend), and I've written a little Ajax code to fetch the data  
> and
> template, do the transform, and stuff the results into the innerHTML
> property of a <div> for the onscreen displays. Works great; gives the
> same results as my DIT tools.
>
> As to creating a Word document... Using the same data and WordML
> transform as I have on the DIT-enabled server, I've managed to do a
> transform and I have what I believe to be the resulting XML/WordML  
> in a
> variable. It's about the right length, anyway (700K bytes). The  
> problem
> is that I can't for the life of me figure out how to get it from
> Javascript into Word.
>
> If I put this exact data in a file (document produced by doing the
> transform offline) sitting on the server, and I open that in IE, IE
> offers me an open-or-save dialog and I'm good; Word opens a
> properly-formed and perfectly-formatted document. The URL is of the  
> form
> http://server.address/library/test.xml. Simple stuff.
>
> Ideally, I'd like to simulate this on the client - provide appropriate
> headers and the contents of the javascript variable to IE to open as  
> if
> it were streaming from a web server. I've tried playing with the  
> window
> object but I'm getting nowhere; IE just tries to write the output as  
> raw
> text to the browser window. Not useful. I've played with  
> ActiveXObjects
> but to no avail; I keep getting prompts to run the ActiveX control,  
> and
> then Word won't open. Even if it did, I find nothing in the Word  
> object
> model that leads me to believe that I can provide my Javascript/WordML
> as if it were coming in through File->Open. Also, I'm not a fan of  
> this
> approach for portability reasons, but if I could make it work, I'd  
> be a
> good couple of steps ahead of where I am.
>
> Google is leading me in circles. I keep finding the same
> not-so-very-helpful web pages.
>
> In a nutshell, I'd like to present HTTP headers and the transform
> results (XML/WordML) created in the client browser to the same client
> browser in such a way as it acts as though I'd opened it from a web
> server.
>
> Can anyone give me a nudge in a useful direction?
>
> Thanks,
>
> Dave Shaw
>
> _______________________________________________
> Javascript mailing list
> Javascript at lists.evolt.org
> http://lists.evolt.org/mailman/listinfo/javascript


More information about the Javascript mailing list