poi-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Tahir Akhtar" <ta...@spectrum-tech.com>
Subject RE: Excel Sheet Title
Date Thu, 09 Mar 2006 10:43:34 GMT
Yes that’s true. But it opens a host of other issues, like security (other
people may be able to download the generated file) and need to have clean-up
jobs possibly tied to session expiry event.

Regards,
Tahir

-----Original Message-----
From: R S [mailto:tcat.seq@gmail.com] 
Sent: Thursday, March 09, 2006 4:39 AM
To: POI Users List
Subject: Re: Excel Sheet Title

The only guaranteed way of serving back Excel with the name is to stream the
generated excel to a temp directory on the web server and then send a client
side redirect to that file.

RS



On 3/8/06, JD828@daimlerchrysler.com <JD828@daimlerchrysler.com> wrote:
>
> I don't really want to save the file right away.  I want to let the user
> view it and I want to specify the title and suggest the filename when they
> save it.  This works in Firefox:
>
> response.setContentType("application/vnd.ms-excel");
> response.setHeader("Content-Disposition", "attachment; filename=" +
> filename);
>
> But not IE.  IE just show the servlet name as before.
>
> Thanks again.
>
> Jody
>
>
>
>
>
> "Tahir Akhtar" <tahir@spectrum-tech.com>
> 03/08/2006 10:04 AM
> Please respond to
> "POI Users List" <poi-user@jakarta.apache.org>
>
>
> To
> "'POI Users List'" <poi-user@jakarta.apache.org>
> cc
>
> Subject
> RE: Excel Sheet Title
>
>
>
>
>
>
> Jody,
> You need to set content-disposition header
>
> // Set the headers.
> res.setContentType("application/x-download");
> res.setHeader("Content-Disposition", "attachment; filename=" + filename);
>
> For more details see
> http://www.onjava.com/pub/a/onjava/excerpt/jebp_3/index3.html
>
> Hope this helps.
>
> Regards,
> Tahir
>
> -----Original Message-----
> From: JD828@daimlerchrysler.com [mailto:JD828@daimlerchrysler.com]
> Sent: Wednesday, March 08, 2006 7:53 PM
> To: poi-user@jakarta.apache.org
> Subject: Excel Sheet Title
>
> Is there any way to change the default file save name and title when I
> create a spreadsheet?  Right now it is the name and path of my servlet.
> That's totally not what I want.  I searched and searched and could not
> find anything.  Here's my code:
>
> In the servlet:
> private void displayBUSRxsl(BusrView busrView, int langId, int currId,
> HttpServletResponse response) throws Exception
> {
>        try{
>                SRMCreateXls xls = new SRMCreateXls();
>                HSSFWorkbook wb = xls.createBUSRWorkbook(busrView, langId,
>
> currId);
>                response.setContentType("application/vnd.ms-excel");
>                ServletOutputStream out = response.getOutputStream();
>                wb.write(out);
>                out.write(wb.getBytes());
>                out.close();
>        }
>        catch(Exception e){
>                throw new SRMException(e.getMessage());
>        }
> }
>
> Is it because I'm using a ServletOutputStream?  The fileOutputStream lets
> you create a file name whereas the ServletOutputStream does not.  And I
> don't see anything in POI that lets me name the file.
>
> Also, I want to set the column width for each column.  Do I have to do
> that for each row?  I have tried several variations of this and it seems
> the only way I can get it to work is to set the column width for each row.
>
> That seems like oeverkill to me so I'm thinking I'm just not doing it
> right.
>
> Another issue I have is that I can't set the column with:
> spreadsheet.setColumnWidth((short) (0), (short) 20);
> I have to use this formula.
> spreadsheet.setColumnWidth((short) (0), (short) ((50 * 8) / ((double) 1 /
> 10)));
> I played with just using a number for a long time before trying it just
> like the example.   Is this for real or am I missing something?
>
> And while I'm here, why are my error messages always empty?
>
> Thanks for any suggestions or observations.
>
> Jody
>
> --
> No virus found in this incoming message.
> Checked by AVG Free Edition.
> Version: 7.1.375 / Virus Database: 268.2.0/276 - Release Date: 3/7/2006
>
>
> --
> No virus found in this outgoing message.
> Checked by AVG Free Edition.
> Version: 7.1.375 / Virus Database: 268.2.0/276 - Release Date: 3/7/2006
>
>
>
> ---------------------------------------------------------------------
> 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/
>
>
>
>

-- 
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.1.375 / Virus Database: 268.2.1/277 - Release Date: 3/8/2006
 

-- 
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.375 / Virus Database: 268.2.1/277 - Release Date: 3/8/2006
 


---------------------------------------------------------------------
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