Thank you.  I did read it.  But it only deals with effectively downloading 
a file.  When I use that, I get a save dialog with an unknown filetype in 
I.E. (it works better in Firefox), no view dialog, like I want.  If I use:

response.setContentType("application/vnd.ms-excel");
response.setHeader("Content-Disposition", "attachment; filename=" + 
filename);

I get a view dialog but the header doesn't take in I.E.

Maybe I will not be able to do this?

Jody





"Tahir Akhtar" <[EMAIL PROTECTED]> 
03/08/2006 12:12 PM
Please respond to
"POI Users List" <[email protected]>


To
"'POI Users List'" <[email protected]>
cc

Subject
RE: Excel Sheet Title






Jody,
I recommend you look into the tip at
http://www.onjava.com/pub/a/onjava/excerpt/jebp_3/index3.html 

Not a long read.

It explains the reason why the browsers behave strangely when handling
downloads and offers some good suggestions. I remember it recommends using
res.setContentType("application/x-download"); to avoid some common 
gotchas.

Regards,
Tahir


-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, March 08, 2006 10:05 PM
To: POI Users List
Subject: RE: Excel Sheet Title

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" <[EMAIL PROTECTED]> 
03/08/2006 10:04 AM
Please respond to
"POI Users List" <[email protected]>


To
"'POI Users List'" <[email protected]>
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: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, March 08, 2006 7:53 PM
To: [email protected]
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: [EMAIL PROTECTED]
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.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: [EMAIL PROTECTED]
Mailing List:     http://jakarta.apache.org/site/mail2.html#poi
The Apache Jakarta Poi Project:  http://jakarta.apache.org/poi/


Reply via email to