poi-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Danny Mui <da...@muibros.com>
Subject Re: HELP NEEDED re converting HSSFWorkbook and sending as mail attachment
Date Fri, 08 Oct 2004 16:24:07 GMT
can you read the generated file through the file system?  make sure it's 
not a file format issue and not a transmission/api problem.

stephen.a.kleinman@verizon.com wrote:
> 
> 
> 
> Hi,
> Does anyone know how (and hopefully have some code sample for) the best way
> to take a HSSFWorkbook object and write it to Excel, and send it as an
> attachement
> to a mail (from a Java application), without having to write it to a file.
> 
> I'm using this code below, along with a Java mailer, but it's not quite
> working.
> The recipient does get an attachment, but it opens in excel with an error,
> and some of the formatting is lost in the process.
> 
> Anyone see the problem,.......or have some code that works?
> THANKS,
> Steve
> 
> String toAddress = repParams.getemailName();
>     String subject = repParams.getrptName();
>     try{
>     ByteArrayOutputStream os = new ByteArrayOutputStream();
>     hssfWorkbook.write(os);
>     byte[] osByte = os.toByteArray();
>     Emailer em = new Emailer(Emailer.MAILER_FOR_REPORTS);
>     em.createMail("Successfully sent the report","Report.xls",osByte);
>     em.setToAddress(toAddress);
>     em.setSubject(subject);
>     em.sendEmail();
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: poi-user-help@jakarta.apache.org

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


Mime
View raw message