[Javascript] Javascript Digest, Vol 27, Issue 1

Dave Shaw dshaw256 at centurylink.net
Mon Mar 22 19:02:26 CDT 2010


Terry and Mark, thank you for your responses. The Data URI scheme looks
just about right. Unfortunately, in a corporate SharePoint environment,
I can't get away from IE. And they won't let me do any custom
development on the server side to do an intermediate write.

But you close a door and another opens. Totally defeated, I took a fresh
look at the problem and discovered that I can do it very easily directly
in Word. It's quite a bit less flexible than a Javascript approach, but
my immediate application doesn't require flexibility.

Drifting away from Javascript for a bit (sorry)... The gist of the
solution is to use a "loader" word document that, when loaded from the
SharePoint site, automatically fetches the XML and XSLT and does the
transform in  Word. A bit incomplete (there's a document window that
needs to be closed - 2 or 3 more lines or so), the VBA code is as
follows:

Sub AutoOpen()
    Documents.Open FileName:="http://server/library/datafile.xml", _
        ConfirmConversions:=False, ReadOnly:=False,
AddToRecentFiles:=False, _
        PasswordDocument:="", PasswordTemplate:="", Revert:=False, _
        WritePasswordDocument:="", WritePasswordTemplate:="", Format:= _
        wdOpenFormatAuto,
XMLTransform:="http://server/library/transform.xsl"
End Sub

Trivial. And anticlimactic.

Thanks again, all.

Dave Shaw



> email message attachment
> 
> > -------- Forwarded Message --------
> > From: Terry Riegel <riegel at clearimageonline.com>
> > Reply-To: JavaScript List <javascript at lists.evolt.org>
> > To: JavaScript List <javascript at lists.evolt.org>
> > Subject: Re: [Javascript] Client-side Word document creation via
> > XML/XSLT
> > Date: Sun, 21 Mar 2010 21:50:07 -0400
> > 
> > 
> > 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
> > 



> email message attachment
> 
> > -------- Forwarded Message --------
> > From: Rees, Mark <Mark.Rees at astrazeneca.com>
> > Reply-To: JavaScript List <javascript at lists.evolt.org>
> > To: JavaScript List <javascript at lists.evolt.org>
> > Subject: Re: [Javascript] Client-side Word document creation via
> > XML/XSLT
> > Date: Mon, 22 Mar 2010 09:54:48 -0000
> > 
> > 
> > That's an interesting question. I don't know of any way to generate a Response in a browser which can then be presented to the browser for interpretation. As you say, that's effectively what you need. One very inefficient and clumsy way to do this, if you had access to the server, would be to send the generated word document to the server and have it echo it back in a properly prepared response. However if you are going that far you would be a lot better off generating the Word document on the server in the first place, which I assume isn't an option. 
> > 
> > I presume you're not working in a closed environment here, but if you were then you could perhaps (having arranged the necessary permissions) write the file to a local disk on the client, then open it from there using JavaScript. It's unlikely you will be granted that level of control though, certainly not if this is an internet application.
> > 
> > Good luck
> > 
> > Mark




More information about the Javascript mailing list