You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@poi.apache.org by JD...@daimlerchrysler.com on 2006/03/08 15:52:39 UTC
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
RE: Excel Sheet Title
Posted by Tahir Akhtar <ta...@spectrum-tech.com>.
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 <JD...@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" <ta...@spectrum-tech.com>
> 03/08/2006 10:04 AM
> Please respond to
> "POI Users List" <po...@jakarta.apache.org>
>
>
> To
> "'POI Users List'" <po...@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/
Re: Excel Sheet Title
Posted by R S <tc...@gmail.com>.
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 <JD...@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" <ta...@spectrum-tech.com>
> 03/08/2006 10:04 AM
> Please respond to
> "POI Users List" <po...@jakarta.apache.org>
>
>
> To
> "'POI Users List'" <po...@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/
>
>
>
>
RE: Excel Sheet Title
Posted by JD...@daimlerchrysler.com.
Thanks everybody but none of this is working. I'll keep trying whatever
you all come up with but for now I have to move on to something else.
Jody
Thomas.Laengle@sealedair.com
03/09/2006 04:19 AM
Please respond to
"POI Users List" <po...@jakarta.apache.org>
To
"POI Users List" <po...@jakarta.apache.org>
cc
Subject
RE: Excel Sheet Title
Hi Jody,
I think I have tried to fix this problem in the past. I found some good
information at the Sun forums.
Perhaps these links will help you:
http://forum.java.sun.com/thread.jspa?threadID=586671&tstart=0
http://forum.java.sun.com/thread.jspa?forumID=31&threadID=626038
Unfortunately I'm not working with a J2EE compliant app server. Therefore
in my environment the setHeader() method is not available for the Response
object. So I was not able to fix the problem.
I guess this code might fix the problem:
###
aResponse.addHeaderLine("Expires: -1"); //The content expires immediately
aResponse.addHeaderLine("Cache-Control: max-age=0");
aResponse.addHeaderLine("Accept-Ranges: bytes");
aResponse.addHeaderLine("Pragma: public"); //very important !!!
###
Just replace addHeaderLine with setHeader() :-)
If you are working with a J2EE compliant server, could you please give me
a
feedback if the work-a-round helped you out.
Regards.
Thomas
JD828@daimlerchry
sler.com
To
08.03.2006 19:27 "POI Users List"
<po...@jakarta.apache.org>
cc
Please respond to
"POI Users List" Subject
<poi-user@jakarta RE: Excel Sheet Title
.apache.org>
That didn't do it either but thanks for trying.
Jody
"Tahir Akhtar" <ta...@spectrum-tech.com>
03/08/2006 01:07 PM
Please respond to
"POI Users List" <po...@jakarta.apache.org>
To
"'POI Users List'" <po...@jakarta.apache.org>
cc
Subject
RE: Excel Sheet Title
You can also try setting content type to application/octet-stream .
This helps in many cases. I used it for downloading csv files and it
worked
correctly in latest version of both IE and Firefox.
Regards,
Tahir
-----Original Message-----
From: JD828@daimlerchrysler.com [mailto:JD828@daimlerchrysler.com]
Sent: Wednesday, March 08, 2006 10:32 PM
To: POI Users List
Subject: RE: Excel Sheet Title
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" <ta...@spectrum-tech.com>
03/08/2006 12:12 PM
Please respond to
"POI Users List" <po...@jakarta.apache.org>
To
"'POI Users List'" <po...@jakarta.apache.org>
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: JD828@daimlerchrysler.com [mailto:JD828@daimlerchrysler.com]
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" <ta...@spectrum-tech.com>
03/08/2006 10:04 AM
Please respond to
"POI Users List" <po...@jakarta.apache.org>
To
"'POI Users List'" <po...@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.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.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/
---------------------------------------------------------------------
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/
RE: Excel Sheet Title
Posted by Th...@sealedair.com.
Hi Jody,
I think I have tried to fix this problem in the past. I found some good
information at the Sun forums.
Perhaps these links will help you:
http://forum.java.sun.com/thread.jspa?threadID=586671&tstart=0
http://forum.java.sun.com/thread.jspa?forumID=31&threadID=626038
Unfortunately I'm not working with a J2EE compliant app server. Therefore
in my environment the setHeader() method is not available for the Response
object. So I was not able to fix the problem.
I guess this code might fix the problem:
###
aResponse.addHeaderLine("Expires: -1"); //The content expires immediately
aResponse.addHeaderLine("Cache-Control: max-age=0");
aResponse.addHeaderLine("Accept-Ranges: bytes");
aResponse.addHeaderLine("Pragma: public"); //very important !!!
###
Just replace addHeaderLine with setHeader() :-)
If you are working with a J2EE compliant server, could you please give me a
feedback if the work-a-round helped you out.
Regards.
Thomas
JD828@daimlerchry
sler.com
To
08.03.2006 19:27 "POI Users List"
<po...@jakarta.apache.org>
cc
Please respond to
"POI Users List" Subject
<poi-user@jakarta RE: Excel Sheet Title
.apache.org>
That didn't do it either but thanks for trying.
Jody
"Tahir Akhtar" <ta...@spectrum-tech.com>
03/08/2006 01:07 PM
Please respond to
"POI Users List" <po...@jakarta.apache.org>
To
"'POI Users List'" <po...@jakarta.apache.org>
cc
Subject
RE: Excel Sheet Title
You can also try setting content type to application/octet-stream .
This helps in many cases. I used it for downloading csv files and it
worked
correctly in latest version of both IE and Firefox.
Regards,
Tahir
-----Original Message-----
From: JD828@daimlerchrysler.com [mailto:JD828@daimlerchrysler.com]
Sent: Wednesday, March 08, 2006 10:32 PM
To: POI Users List
Subject: RE: Excel Sheet Title
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" <ta...@spectrum-tech.com>
03/08/2006 12:12 PM
Please respond to
"POI Users List" <po...@jakarta.apache.org>
To
"'POI Users List'" <po...@jakarta.apache.org>
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: JD828@daimlerchrysler.com [mailto:JD828@daimlerchrysler.com]
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" <ta...@spectrum-tech.com>
03/08/2006 10:04 AM
Please respond to
"POI Users List" <po...@jakarta.apache.org>
To
"'POI Users List'" <po...@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.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.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/
---------------------------------------------------------------------
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/
RE: Excel Sheet Title
Posted by JD...@daimlerchrysler.com.
That didn't do it either but thanks for trying.
Jody
"Tahir Akhtar" <ta...@spectrum-tech.com>
03/08/2006 01:07 PM
Please respond to
"POI Users List" <po...@jakarta.apache.org>
To
"'POI Users List'" <po...@jakarta.apache.org>
cc
Subject
RE: Excel Sheet Title
You can also try setting content type to application/octet-stream .
This helps in many cases. I used it for downloading csv files and it
worked
correctly in latest version of both IE and Firefox.
Regards,
Tahir
-----Original Message-----
From: JD828@daimlerchrysler.com [mailto:JD828@daimlerchrysler.com]
Sent: Wednesday, March 08, 2006 10:32 PM
To: POI Users List
Subject: RE: Excel Sheet Title
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" <ta...@spectrum-tech.com>
03/08/2006 12:12 PM
Please respond to
"POI Users List" <po...@jakarta.apache.org>
To
"'POI Users List'" <po...@jakarta.apache.org>
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: JD828@daimlerchrysler.com [mailto:JD828@daimlerchrysler.com]
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" <ta...@spectrum-tech.com>
03/08/2006 10:04 AM
Please respond to
"POI Users List" <po...@jakarta.apache.org>
To
"'POI Users List'" <po...@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.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.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/
RE: Excel Sheet Title
Posted by Tahir Akhtar <ta...@spectrum-tech.com>.
You can also try setting content type to application/octet-stream .
This helps in many cases. I used it for downloading csv files and it worked
correctly in latest version of both IE and Firefox.
Regards,
Tahir
-----Original Message-----
From: JD828@daimlerchrysler.com [mailto:JD828@daimlerchrysler.com]
Sent: Wednesday, March 08, 2006 10:32 PM
To: POI Users List
Subject: RE: Excel Sheet Title
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" <ta...@spectrum-tech.com>
03/08/2006 12:12 PM
Please respond to
"POI Users List" <po...@jakarta.apache.org>
To
"'POI Users List'" <po...@jakarta.apache.org>
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: JD828@daimlerchrysler.com [mailto:JD828@daimlerchrysler.com]
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" <ta...@spectrum-tech.com>
03/08/2006 10:04 AM
Please respond to
"POI Users List" <po...@jakarta.apache.org>
To
"'POI Users List'" <po...@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.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.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/
RE: Excel Sheet Title
Posted by JD...@daimlerchrysler.com.
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" <ta...@spectrum-tech.com>
03/08/2006 12:12 PM
Please respond to
"POI Users List" <po...@jakarta.apache.org>
To
"'POI Users List'" <po...@jakarta.apache.org>
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: JD828@daimlerchrysler.com [mailto:JD828@daimlerchrysler.com]
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" <ta...@spectrum-tech.com>
03/08/2006 10:04 AM
Please respond to
"POI Users List" <po...@jakarta.apache.org>
To
"'POI Users List'" <po...@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.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/
RE: Excel Sheet Title
Posted by Tahir Akhtar <ta...@spectrum-tech.com>.
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: JD828@daimlerchrysler.com [mailto:JD828@daimlerchrysler.com]
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" <ta...@spectrum-tech.com>
03/08/2006 10:04 AM
Please respond to
"POI Users List" <po...@jakarta.apache.org>
To
"'POI Users List'" <po...@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.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/
RE: Excel Sheet Title
Posted by JD...@daimlerchrysler.com.
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" <ta...@spectrum-tech.com>
03/08/2006 10:04 AM
Please respond to
"POI Users List" <po...@jakarta.apache.org>
To
"'POI Users List'" <po...@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/
RE: Excel Sheet Title
Posted by Kurt Stein <ku...@liquio.com>.
you can specify the name -- the download path behaves diifferently depending on the browser(IE/Netscape-Mozilla)
the best you can get from download path is for it to remember the path
that the open browser was downloaded to - note this varies from Netscape to IE
we like to serialize download names - to force uniqueness -
you can modify the name generation section with variables
goodluck
Kurt
-----Original Message-----
From: JD828@daimlerchrysler.com [mailto:JD828@daimlerchrysler.com]
Sent: Wednesday, March 08, 2006 9:24 AM
To: POI Users List
Subject: RE: Excel Sheet Title
Yes that works. Thank you so much.
Jody
"Tahir Akhtar" <ta...@spectrum-tech.com>
03/08/2006 10:04 AM
Please respond to
"POI Users List" <po...@jakarta.apache.org>
To
"'POI Users List'" <po...@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/
---------------------------------------------------------------------
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/
RE: Excel Sheet Title
Posted by JD...@daimlerchrysler.com.
Yes that works. Thank you so much.
Jody
"Tahir Akhtar" <ta...@spectrum-tech.com>
03/08/2006 10:04 AM
Please respond to
"POI Users List" <po...@jakarta.apache.org>
To
"'POI Users List'" <po...@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/
RE: Excel Sheet Title
Posted by Tahir Akhtar <ta...@spectrum-tech.com>.
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/