ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   html exported to excel when save as, defaults to web page (https://www.excelbanter.com/excel-programming/403870-html-exported-excel-when-save-defaults-web-page.html)

jayahn

html exported to excel when save as, defaults to web page
 
When I export html code in the .jsp to excel, and I open the .xls file, and
try to Save As, the file type automatically defaults to webpage file. I want
it to default to .xls file.

I have tried a number of methods. I have tried exporting from the .jsp with
no code at all(basically it opens a empty .xls file). This tried to save the
..xls file as a text delimited. When I added only the <html</html tags, it
returned to trying to save as webpage. I suspect that there must be some
tag(or at least some identification flag) that sets the Save As filetype
accordingly, but I cannot find where or what it is.

Thank you.

- Jay -

Tim Williams

html exported to excel when save as, defaults to web page
 
What headers are you adding to the jsp response ?
Try something like:

Response.AddHeader "Content-Disposition", "inline; filename=weberport1.xls"
Response.ContentType = "application/vnd.ms-excel"

(above is ASP syntax)

Tim

"jayahn" wrote in message
...
When I export html code in the .jsp to excel, and I open the .xls file,
and
try to Save As, the file type automatically defaults to webpage file. I
want
it to default to .xls file.

I have tried a number of methods. I have tried exporting from the .jsp
with
no code at all(basically it opens a empty .xls file). This tried to save
the
.xls file as a text delimited. When I added only the <html</html tags,
it
returned to trying to save as webpage. I suspect that there must be some
tag(or at least some identification flag) that sets the Save As filetype
accordingly, but I cannot find where or what it is.

Thank you.

- Jay -




jayahn

html exported to excel when save as, defaults to web page
 
Yea, the headers that you have noted had already been added, except it's not
"inline;", its "attachment;". Sorry, I should have mentioned that. I've tried
"inline;" and not only does it default to Save As Web Page, it does not have
the option of saving as an .xls file.

- Jay -

"Tim Williams" wrote:

What headers are you adding to the jsp response ?
Try something like:

Response.AddHeader "Content-Disposition", "inline; filename=weberport1.xls"
Response.ContentType = "application/vnd.ms-excel"

(above is ASP syntax)

Tim

"jayahn" wrote in message
...
When I export html code in the .jsp to excel, and I open the .xls file,
and
try to Save As, the file type automatically defaults to webpage file. I
want
it to default to .xls file.

I have tried a number of methods. I have tried exporting from the .jsp
with
no code at all(basically it opens a empty .xls file). This tried to save
the
.xls file as a text delimited. When I added only the <html</html tags,
it
returned to trying to save as webpage. I suspect that there must be some
tag(or at least some identification flag) that sets the Save As filetype
accordingly, but I cannot find where or what it is.

Thank you.

- Jay -





[email protected]

html exported to excel when save as, defaults to web page
 
Does the XL file open directly in Excel, or is it hosted in IE ?

Tim


On Jan 9, 6:44*am, jayahn wrote:
Yea, the headers that you have noted had already been added, except it's not
"inline;", its "attachment;". Sorry, I should have mentioned that. I've tried
"inline;" and not only does it default to Save As Web Page, it does not have
the option of saving as an .xls file.

- Jay -



"Tim Williams" wrote:
What headers are you adding to the jsp response ?
Try something like:


Response.AddHeader "Content-Disposition", "inline; filename=weberport1..xls"
Response.ContentType = "application/vnd.ms-excel"


(above is ASP syntax)


Tim


"jayahn" wrote in message
...
When I export html code in the .jsp to excel, and I open the .xls file,
and
try to Save As, the file type automatically defaults to webpage file. I
want
it to default to .xls file.


I have tried a number of methods. I have tried exporting from the .jsp
with
no code at all(basically it opens a empty .xls file). This tried to save
the
.xls file as a text delimited. When I added only the <html</html tags,
it
returned to trying to save as webpage. I suspect that there must be some
tag(or at least some identification flag) that sets the Save As filetype
accordingly, but I cannot find where or what it is.


Thank you.


- Jay -- Hide quoted text -


- Show quoted text -



jayahn

html exported to excel when save as, defaults to web page
 
When I have the header:

Response.AddHeader "Content-Disposition", "attachment;
filename=weberport1..xls"

It directs the file to be opened in Excel, which is what I want. But it
still defaults to Save As Web Page. (If is "inline" instead of "attachment",
it will open in IE.)

- Jay -



" wrote:

Does the XL file open directly in Excel, or is it hosted in IE ?

Tim


On Jan 9, 6:44 am, jayahn wrote:
Yea, the headers that you have noted had already been added, except it's not
"inline;", its "attachment;". Sorry, I should have mentioned that. I've tried
"inline;" and not only does it default to Save As Web Page, it does not have
the option of saving as an .xls file.

- Jay -



"Tim Williams" wrote:
What headers are you adding to the jsp response ?
Try something like:


Response.AddHeader "Content-Disposition", "inline; filename=weberport1..xls"
Response.ContentType = "application/vnd.ms-excel"


(above is ASP syntax)


Tim


"jayahn" wrote in message
...
When I export html code in the .jsp to excel, and I open the .xls file,
and
try to Save As, the file type automatically defaults to webpage file. I
want
it to default to .xls file.


I have tried a number of methods. I have tried exporting from the .jsp
with
no code at all(basically it opens a empty .xls file). This tried to save
the
.xls file as a text delimited. When I added only the <html</html tags,
it
returned to trying to save as webpage. I suspect that there must be some
tag(or at least some identification flag) that sets the Save As filetype
accordingly, but I cannot find where or what it is.


Thank you.


- Jay -- Hide quoted text -


- Show quoted text -





All times are GMT +1. The time now is 01:45 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com