Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

opening Excel file in browser problem

Status
Not open for further replies.

DeSn

Programmer
Nov 20, 2001
111
0
0
BE
Hello,

When I open a MS Excel file with the following javascript command:

t = window.open("rapportering.xls","rapportgenerator","toolbar,status,menubar,resizable,location");

I receive strange signs like this (it is like it doesn't know it is an excel file?):

ÐÏࡱá>þÿ "  !þÿÿÿ*6%&'()+.,-/LF123457]8D:;<=>?@ABC0EþÿÿÿGHIJKMRNOPQS[TUVWX\Zþÿÿÿo^þÿÿÿ_Tahoma1Ãÿ¼Arial1Ãÿ¼Arial#,##0\ "BF";\-#,##0\ "BF"##,##0\ "BF";[Red]\-#,##0\ "BF"$#,##0.00\ "BF";\-#,##0.00\ "BF")$#,##0.00\ "BF";[Red]\-#,##0.00

I can open the Excel file without any problems in MS Excel and even in IE or Netscape when I drap and drop it.

Can anyone help me with this problem?
 

You're opening a binary Excel file in a web browser - why would it work? Why should it work?

The fact that it works when dragged and dropped has no relevance here. You try and open a binary file in a browser, you'll see the "strange signs" that you see.

Dan


 
ok

So how can I make it work?
 

If you set the MIME type on the server to deliver .xls files as the correct filetype for Excel files (I'm not 100% sure what this should be) then it might just work. But that's just a guess.

Dan
 
I have found the solution

I've added this to my web.xml

<mime-mapping>
<extension>xls</extension>
<mime-type>application/vnd.ms-excel</mime-type>
</mime-mapping>
 
BillyRayPreachersSon said:
Nice solution!
I think "nice point in the right direction" would be more appropriate. Not to mention a "thanks for giving me an idea of where to start".

Seriously people.....

What's up with ppl asking for help and then not saying thanks after you get your answer? Let alone granting <censored>stars</censored> for helpful posts..... The ones that really irk me are the ones that get the answer and never even post a follow up. At least you had the decency to post the solution afterwards DeSn, but at least give credit where credit is due.

Dan, great job hitting that one right on the head. It's always nice when our "guesses" work out just the way we hoped.

-kaht

banghead.gif
 
This is a great solution. Is there any way changes can be made and saved as we have people in multiple locations who need to update xls files? (pushing it, huh?)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top