You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@poi.apache.org by Dreamcatcher <at...@gmail.com> on 2009/08/05 11:06:04 UTC

Write data in unsaved Ecxel File...

Hi Guyz..

I am using Apache POI in my project. I want to export the data from data
Table to an EXCEL FILE, thanks to apache POI library through which i got
success in that task. But now the problem is that i want such excel file
which doesnt exist i.e. which is not be saved on my hard drive, Inshort i
just want to write data in an Unsaved Excel file in such a way that whenever
user clicks the menu of Export To Excel an Excel Sheet gets opened with no
name and with no path over my hardrive but should contains the data of that
particular data Table.....

I would be very grateful to you guyz for any sort of help... 

Regards:
Dreamcatcher....
-- 
View this message in context: http://www.nabble.com/Write-data-in-unsaved-Ecxel-File...-tp24823324p24823324.html
Sent from the POI - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org


RE: Write data in unsaved Ecxel File...

Posted by Christian Gosch <ch...@inovex.de>.
It should be mentioned that IE as a browser will store the downloaded 
file on disk in its cache system ("temporary internet files") before it 
opens it. This is the case regardless of content disposition. Other 
browsers will behave similar.

If it is important that the file is never resident on disc, this may be 
important.

If it is only important to unburden the user from the decision and 
effort to store the file somewhere and reopen it manually, the solution 
given should be sufficient.

Another possible way may be utilizing things like DDE (still alive or 
already dead?) or OLE or whatever MS uses for IPC currently. But then 
the Java application will have to make use of these Windows-specific 
features which may be quite untrivial. ;-)

--cg

> -----Original Message-----
> From: David Fisher [mailto:dfisher@jmlafferty.com]
> Sent: Wednesday, August 05, 2009 6:11 PM
> To: POI Users List
> Subject: Re: Write data in unsaved Ecxel File...
> 
> Hi,
> 
> There is one way you could get this effect - at least this worked
> several years ago. If you have your POI application as part of a web
> servlet container like Tomcat, then you can serve up the Excel file
> that you create in memory - write the response output stream. The
> trick is that you will use a content-disposition of "inline" then
> assuming the user is using IE and has not changed the default behavior
> the Excel file should open in Excel in an IE window. The user should
> then be able to save the file, or not.
> 
> Look in the email archives for a servlet container piece I posted
> recently.
> 
> Good luck.
> 
> Regards,
> Dave
> 
> On Aug 5, 2009, at 2:06 AM, Dreamcatcher wrote:
> 
> >
> > Hi Guyz..
> >
> > I am using Apache POI in my project. I want to export the data from
> > data
> > Table to an EXCEL FILE, thanks to apache POI library through which i
> > got
> > success in that task. But now the problem is that i want such excel
> > file
> > which doesnt exist i.e. which is not be saved on my hard drive,
> > Inshort i
> > just want to write data in an Unsaved Excel file in such a way that
> > whenever
> > user clicks the menu of Export To Excel an Excel Sheet gets opened
> > with no
> > name and with no path over my hardrive but should contains the data
> > of that
> > particular data Table.....
> >
> > I would be very grateful to you guyz for any sort of help...
> >
> > Regards:
> > Dreamcatcher....
> > --
> > View this message in context: http://www.nabble.com/Write-data-in-
> unsaved-Ecxel-File...-tp24823324p24823324.html
> > Sent from the POI - User mailing list archive at Nabble.com.
> >
> >
> > 
---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
> > For additional commands, e-mail: user-help@poi.apache.org
> >
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
> For additional commands, e-mail: user-help@poi.apache.org
> 
> 
> !DSPAM:4a79af58326665510920803!
> 
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org


Re: Write data in unsaved Ecxel File...

Posted by David Fisher <df...@jmlafferty.com>.
Hi,

There is one way you could get this effect - at least this worked  
several years ago. If you have your POI application as part of a web  
servlet container like Tomcat, then you can serve up the Excel file  
that you create in memory - write the response output stream. The  
trick is that you will use a content-disposition of "inline" then  
assuming the user is using IE and has not changed the default behavior  
the Excel file should open in Excel in an IE window. The user should  
then be able to save the file, or not.

Look in the email archives for a servlet container piece I posted  
recently.

Good luck.

Regards,
Dave

On Aug 5, 2009, at 2:06 AM, Dreamcatcher wrote:

>
> Hi Guyz..
>
> I am using Apache POI in my project. I want to export the data from  
> data
> Table to an EXCEL FILE, thanks to apache POI library through which i  
> got
> success in that task. But now the problem is that i want such excel  
> file
> which doesnt exist i.e. which is not be saved on my hard drive,  
> Inshort i
> just want to write data in an Unsaved Excel file in such a way that  
> whenever
> user clicks the menu of Export To Excel an Excel Sheet gets opened  
> with no
> name and with no path over my hardrive but should contains the data  
> of that
> particular data Table.....
>
> I would be very grateful to you guyz for any sort of help...
>
> Regards:
> Dreamcatcher....
> -- 
> View this message in context: http://www.nabble.com/Write-data-in-unsaved-Ecxel-File...-tp24823324p24823324.html
> Sent from the POI - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
> For additional commands, e-mail: user-help@poi.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org


Re: Write data in unsaved Ecxel File...

Posted by MSB <ma...@tiscali.co.uk>.
SWT is actually a part of the Eclipse development platform so, if you use
that to write your code with then you will already have the necessary
archive and, most likely, the required dll(s). As the technique relies on
dll(s), I have to stress that it is suitable only for use on Windows
plaforms. It has been a very long time since I last looked at Wine and I
cannot say whether it is yet ready to 'support' dll(s) on Linux platforms
but it may be worth your digging around to see if things have progressed -
http://www.winehq.org/.

Perhaps the best place to start is with the originators of the archive;

http://www.eclipse.org/swt/

There you can get the archive, look at the documentation, etc.

A good intro to using SWT can be found here;

http://www.java2s.com/Code/Java/SWT-JFace-Eclipse/SWTOleFrame.htm

and it deals with running an application in a frame.

This digs deeper and there is more code for you to take a look at including
running Excel in a frame;

http://www.vogella.de/articles/EclipseMicrosoftIntegration/article.html

This links you to the examples section of the Eclipse site;

http://help.eclipse.org/stable/index.jsp?topic=/org.eclipse.platform.doc.isv/samples/org.eclipse.swt.examples.ole.win32/doc-html/swt_ole_ex.html

and there are others; just Google around a bit for something like 'SWT OLE'.

I have some experience of using SWT/OLE to control Excel indirectly, that is
outside of a frame, and an happy to help where I can - though I would say
that any discussions should be kept off of this list. If you chose to adopt
that approach, you could still use your existing methodology to gather the
data and then, when the user clicks on a button, grab the information and
use SWT/OLE to create a new workbook, populate it and present the results to
the user; remember though that Microsoft specifically advise against using
such an approach because - amongst other reasons - the application was
designed to be used interactively.

Yours

Mark B


Dreamcatcher wrote:
> 
> first of all thanks to you all for your precious time...
> 
> The first thing i would like to clarify is that my application dont have
> any link with explorer and tomcat so the option of IE is not valid for my
> application...
> 
> Secondly i would just like to say that i dont have any information about
> using this OLE and COM/DCOM with SWT JAVA classes so if u guys just give
> me any helping material or any useful links through which i would be able
> to get the required data to perform that task....
> 
> Thanks all in advance....
> 
> 

-- 
View this message in context: http://www.nabble.com/Write-data-in-unsaved-Ecxel-File...-tp24823324p24863482.html
Sent from the POI - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org


Re: Write data in unsaved Ecxel File...

Posted by Dreamcatcher <at...@gmail.com>.
first of all thanks to you all for your precious time...

The first thing i would like to clarify is that my application dont have any
link with explorer and tomcat so the option of IE is not valid for my
application...

Secondly i would just like to say that i dont have any information about
using this OLE and COM/DCOM with SWT JAVA classes so if u guys just give me
any helping material or any useful links through which i would be able to
get the required data to perform that task....

Thanks all in advance....

-- 
View this message in context: http://www.nabble.com/Write-data-in-unsaved-Ecxel-File...-tp24823324p24861619.html
Sent from the POI - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org


Re: Write data in unsaved Ecxel File...

Posted by MSB <ma...@tiscali.co.uk>.
Using POI, I would strongly doubt that this is possible; the API is designed
to allow you to create files that can be opened by someone using Excel. You
will always need to create a file as an intermediate step in this sort of
process.

The only option that I can think og is OLE as this would allow you to open
an instance of Excel and populate the workbook for the user to see. This
technique is however quite limited, it is not suitable for use in a
distributed environment, error handling is poor, and you would have to be
running the code on a Windows based PC and a copy of Excel would have to be
installed on that PC.

You could take a look at the SWT classes. If I remember correctly, one of
the containers supports OLE enabled applications so that you could, for
example, have Excel running within a control on a GUI form written using
java code. I do not think that it is possible to mix awt/swing and swt
components however so this could entail quite a bit of extra work on your
part.

Yours

Mark B


Dreamcatcher wrote:
> 
> Hi Guyz..
> 
> I am using Apache POI in my project. I want to export the data from data
> Table to an EXCEL FILE, thanks to apache POI library through which i got
> success in that task. But now the problem is that i want such excel file
> which doesnt exist i.e. which is not be saved on my hard drive, Inshort i
> just want to write data in an Unsaved Excel file in such a way that
> whenever user clicks the menu of Export To Excel an Excel Sheet gets
> opened with no name and with no path over my hardrive but should contains
> the data of that particular data Table.....
> 
> I would be very grateful to you guyz for any sort of help... 
> 
> Regards:
> Dreamcatcher....
> 

-- 
View this message in context: http://www.nabble.com/Write-data-in-unsaved-Ecxel-File...-tp24823324p24831344.html
Sent from the POI - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org