poi-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kamal Upadhyay <kamal.upadh...@gmail.com>
Subject Re: Saving a workbook as an email attachment
Date Fri, 18 Mar 2005 11:51:48 GMT
so Kurt is ur problem finally solved?


On Tue, 15 Mar 2005 09:56:24 +0100, Frans.Flippo@ingbank.com
<Frans.Flippo@ingbank.com> wrote:
> Hi,
> 
> POI writes the workbook to an output stream. That is all POI needs to
> support. There are many types of OutputStreams you can use, or you could
> create your own by extending java.io.OutputStream if that is what you need.
> 
> If you want to store the byte stream in a byte array to attach the resulting
> bytes to an e-mail, use a java.io.ByteArrayOutputStream to write to. The use
> toByteArray() on the stream to get a byte[]. Then you can attach that to
> your e-mail message. Be aware that since the entire byte array is stored in
> memory, this might take some memory for large workbooks.
> 
> Hope that heps.
> 
> And please, don't call people nazis. It's offending.
> 
> Regards,
> Frans
> 
> > -----Original Message-----
> > From: Kurt Stein [mailto:kurt.stein@liquio.com]
> > Sent: Monday, March 14, 2005 8:22 PM
> > To: POI Users List; Kamal Upadhyay
> > Subject: RE: Saving a workbook as an email attachment
> >
> >
> > Thanks for the link from Sun.
> > Saving and sending is quite straight forward, redirecting the
> > stream is a
> > bit harder.
> >
> > Personally I would say it is related to POI as the output is
> > from poi into
> > an attachment.
> > If the HSSFWorkbook write methods had more constructors,
> > writing to email
> > attachment would be easier.
> >
> > Pardon my lack of knowledge of the posting rules and
> > regulations of the
> > POINazi's!
> >
> > Believe me - I have suffered through some thoroughly inane posts!
> >
> >
> > KStein
> >
> > -----Original Message-----
> > From: Kamal Upadhyay [mailto:kamal.upadhyay@gmail.com]
> > Sent: Monday, March 14, 2005 2:00 AM
> > To: POI Users List; kurt.stein@liquio.com
> > Subject: Re: Saving a workbook as an email attachment
> >
> >
> > HI, sending mail and POI r two diferent issues all together. U could
> > do the latter either by saving the generated excel file in the file
> > system and then reading it using mail api, see the code below...
> > however i repeat this is not related to POI so do not post it here
> > rather check this thread
> > http://forum.java.sun.com/thread.jspa?forumID=43&threadID=581609
> >
> > // create the message part with attachment
> >                       MimeBodyPart mbp = new MimeBodyPart();
> > // attach the data to the message
> >                       mbp.setDataHandler(new FileHandler(new
> > FileInputStream(new
> > File("location of ur file"))l;
> > // create the Multipart and add its parts to it
> >                       Multipart mp = new MimeMultipart();
> >                       mp.addBodyPart(mbp);
> > // add the Multipart to the message
> >                       msg.setContent(mp);
> >                       Transport.send(msg);
> >
> > or better still with zero footprint like this
> > // attach the data to the message
> >                       MyDataSource mds = new
> > MyDataSource(bos, "APPLICATION/OCTET-STREAM");
> >                       mbp2.setDataHandler(new DataHandler(mds));
> >                       mbp2.setFileName(reportName + ".xls");
> >
> >
> > On Fri, 4 Mar 2005 08:27:55 -0600, Kurt Stein
> > <kurt.stein@liquio.com> wrote:
> > > Does anyone know how to insert an HSSFWorkbook into a mime
> > attachment?
> > >
> > > Is there a best practice for getting the workbook.write(OutputStream
> > > out)output convert to byte[] and other handler structures used with
> > > java.mail functionality?
> > >
> > > Thanks
> > >
> > > Kurt
> > >
> > > Kurt W. Stein
> > > Liquio Corporation
> > > 318 W. Adams Street
> > > Suite 1306
> > > Chicago, IL 60606
> > > (312) 750-1111
> > > (312) 750-6775 fax
> > > kurt.stein@liquio.com
> > >
> > >
> > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
> > > Mailing List:     http://jakarta.apache.org/site/mail2.html#poi
> > > The Apache Jakarta Poi Project:  http://jakarta.apache.org/poi/
> > >
> > >
> >
> >
> > --
> > bye
> > kamal
> > (Verizon, Chennai)
> > Contact No: 09884339257
> >
> >
> > On Fri, 4 Mar 2005 08:27:55 -0600, Kurt Stein
> > <kurt.stein@liquio.com> wrote:
> > > Does anyone know how to insert an HSSFWorkbook into a mime
> > attachment?
> > >
> > > Is there a best practice for getting the workbook.write(OutputStream
> > > out)output convert to byte[] and other handler structures used with
> > > java.mail functionality?
> > >
> > > Thanks
> > >
> > > Kurt
> > >
> > > Kurt W. Stein
> > > Liquio Corporation
> > > 318 W. Adams Street
> > > Suite 1306
> > > Chicago, IL 60606
> > > (312) 750-1111
> > > (312) 750-6775 fax
> > > kurt.stein@liquio.com
> > >
> > >
> > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
> > > Mailing List:     http://jakarta.apache.org/site/mail2.html#poi
> > > The Apache Jakarta Poi Project:  http://jakarta.apache.org/poi/
> > >
> > >
> >
> >
> > --
> > bye
> > kamal
> > (Verizon, Chennai)
> > Contact No: 09884339257
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
> > Mailing List:     http://jakarta.apache.org/site/mail2.html#poi
> > The Apache Jakarta Poi Project:  http://jakarta.apache.org/poi/
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
> > Mailing List:     http://jakarta.apache.org/site/mail2.html#poi
> > The Apache Jakarta Poi Project:  http://jakarta.apache.org/poi/
> >
> 
> -----------------------------------------------------------------
> ATTENTION:
> The information in this electronic mail message is private and
> confidential, and only intended for the addressee. Should you
> receive this message by mistake, you are hereby notified that
> any disclosure, reproduction, distribution or use of this
> message is strictly prohibited. Please inform the sender by
> reply transmission and delete the message without copying or
> opening it.
> 
> Messages and attachments are scanned for all viruses known.
> If this message contains password-protected attachments, the
> files have NOT been scanned for viruses by the ING mail domain.
> Always scan attachments before opening them.
> -----------------------------------------------------------------
> 
> 


-- 
bye
kamal
(Verizon, Chennai)
Contact No: 09884339257

---------------------------------------------------------------------
To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
Mailing List:     http://jakarta.apache.org/site/mail2.html#poi
The Apache Jakarta Poi Project:  http://jakarta.apache.org/poi/


Mime
View raw message