[Javascript] Client-side Word document creation via XML/XSLT
Dave Shaw
dshaw256 at centurylink.net
Wed Mar 24 18:56:00 CDT 2010
Those are still there for access to the local file system. But I'd have
to get my document-in-a-string into the local file system (I've played
with this and find it "twitchy"), then I might as well just launch Word
and point it at the file. Also twitchy.
The best option would be some kind of internal "shunt" to load-a-page.
I've been playing more with the all-in-Word/VBA approach and it seems
simple and solid. I think I'm good.
Thanks, all.
Dave
On Tue, 2010-03-23 at 18:01 -0600, David Lovering wrote:
> Once upon a time there were alternative URL formats such as
> "file:\\<path-to-file>\<filename>.<extension>". Is it possible that some
> such construct might serve to work for your purposes?
>
> -- Dave Lovering
>
> -----Original Message-----
> From: javascript-bounces at lists.evolt.org
> [mailto:javascript-bounces at lists.evolt.org] On Behalf Of Dave Shaw
> Sent: Tuesday, March 23, 2010 5:51 PM
> To: JavaScript List
> Subject: Re: [Javascript] Client-side Word document creation via XML/XSLT
>
> I still have my test bed set up so I tried it. I didn't get good results
> at all.
>
> I have my XML document developed in a variable named results. I run
> window.open(results) and what I get is an empty browser window with my
> site URL followed by an encoded form of my XML header in the browser's
> address bar.
>
> Window.open really wants a URL.
>
> Dave
>
>
> On Mon, 2010-03-22 at 20:10 -0400, Terry Riegel wrote:
>
> > Troy,
> >
> > I didn't know you could do this. Does it rely on the browser detecting
> > the document type? Do you have any links to this in action? Or should
> > I try to generate a binary file in a JavaScript VAR?
> >
> > Thanks,
> >
> > Terry
> >
> > http://p8ste.com
> >
> > On Mar 22, 2010, at 7:43 PM, Troy III Ajnej <trojani2000 at hotmail.com>
> > wrote:
> >
> > >
> > >
> > >
> > > window.open(variabmeName)
> > >
> > >
> > >
> > >
> > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > > Troy III
> > > progressive art enterprise
> > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > >
> > >
> > >
> > >
> > >
> > >> From: dshaw256 at centurylink.net
> > >> To: javascript at lists.evolt.org
> > >> Date: Sun, 21 Mar 2010 20:05:14 -0400
> > >> Subject: [Javascript] Client-side Word document creation via XML/XSLT
> > >>
> > >> 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
> > >
> > > _________________________________________________________________
> > > Hotmail is redefining busy with tools for the New Busy. Get more
> > > from your inbox.
> > >
> http://www.windowslive.com/campaign/thenewbusy?ocid=PID27925::T:WLMTAGL:ON:W
> L:en-US:WM_HMP:032010_2
> > > _______________________________________________
> > > Javascript mailing list
> > > Javascript at lists.evolt.org
> > > http://lists.evolt.org/mailman/listinfo/javascript
> >
> _______________________________________________
> Javascript mailing list
> Javascript at lists.evolt.org
> http://lists.evolt.org/mailman/listinfo/javascript
>
>
More information about the Javascript
mailing list