Hi,

I think using a server side component to take data from Flex and  
return it in a format suitable for Excel is the best approach, but if  
that's not possible, it is possible to do this all client-side if:

1. Your users are using Internet Explorer on Windows
2. Their security settings are not so locked down that you can't  
access ActiveX from Javascript (IIRC the default is that you are  
warned about a potentially dangerous operation, though this may have  
changed in Vista)
3. You can ship an HTML wrapper as well as the SWF.
4. Your app is not using the local-with-filesystem sandbox.

If you can live with the above you need to write a Javascript  
function and put it inside the HTML wrapper of your app.  In this  
file you need a function that uses ActiveX to start up Excel.  Once  
you've done this you can access the object mode of Excel to put  
values in cells, create charts etc etc.
Googling Javascript, Excel, ActiveX should turn up some examples of  
the kind of Javascript you need.  In your Flex app you just then use  
ExternalInterface to invoke the JS function (hence caveat 4 above).

The only other way to do this I know of (and it's horrible) requires  
shipping an XLS file with your app, you then can put data, formatted  
as CSV or TSV, on to the clipboard, then you use navigateURL to load  
the XLS file in a new window, and in the XLS file you have some  
VBScript that pastes the contents of the clipboard into the sheet.   
Told you it was horrible!  The only plus of this is that it doesn't  
use ExternalInterface and so will work if you are working in the  
local-with-filesystem sandbox.

But seriously... a server side component is the way to go for  
robustness (any of the above could break with the next release of IE  
for all I know).

HTH...
Steve.


On 30 Aug 2007, at 20:46, essuark wrote:

> Thanks for the reply Paul. Other than when the swf loads, there is NO
> server side component like a websevice. It needs to be initiated from
> the swf with data from with-in the swf....
>
> --- In [email protected], Paul deCoursey <[EMAIL PROTECTED]> wrote:
> >
> > NavigateToUrl should work. This is really more of a general Web
> > Development question though. The real work would need to be done
> on the
> > server in some sort of web application. You need to set the header
> of
> > the response to the correct mimetype so that the browser can decide
> what
> > to do with the file. You can also send headers to will instruct
> what to
> > use for a filename. I can't really provide much more guidance
> without
> > more details on what you are using server side, and that would
> really
> > bring us out of scope for this list.
> >
> > Paul
> >
> > essuark wrote:
> > > Hello all,
> > >
> > > I have some simple data that I wish to export to Excel from my
> flex
> > > application. Basically I want to click a button and have
> the 'Save As'
> > > dialog on the browser appear, so the data is dynamic. This needs
> to be
> > > contained in the swf and not access a file somewhere on a server,
> and
> > > since there isn't file, I am not sure if can use NavigatetoURL.
> In
> > > short I wish to send or stream xml data to; I guess, another
> browser.
> > > So again, any ideas on how to send simple xml data, like
> > > <Msg>Hello</Msg> and have the browser's save as dialog show up so
> the
> > > user can save it on their harddrive?
> > >
> > > Thanks
> > > Ralph
> > >
> > >
> > >
> >
>
>
> 

Reply via email to