Q: check if excel installed

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello,
I am using this code to display excel in IE.

locFilesPath = "D:\Files\myFile.xls"
If (System.IO.File.Exists(locFilesPath)) Then
Response.Clear()
Response.ContentType = "Application/x-msexcel"
Response.WriteFile(locFilesPath)
Response.End()
End If

This does not work if remote computer does not have MS office installed. I
need to check if excel installed or not just before this code.
How should I do that?
Thanks,
Jim.
 
First, if you are doing this on the server, you may not be able to tell if
the client has Excel installed. Nothing in your code snippet requires Excel
to be installed, but if the browser receives this byte stream, it will
probably prompt the user to save the file to disk.
 
yes it is prompting to the user to save. I need to get user see an error
message and not able to save it to the disk. can I do that?
 
You do not (by default) have the security permissions necessary to determine
if Excel is installed on the client's computer.
You'd need the user to adjust their browser security settings (so you can
try to instantiate Excel via client side script and trap the related error
if it's not installed) or you'd need some kind of a thick client such as an
ActiveX control.
 
Or just put a notice on the screen asking if they have Excel, if they click
no then dont let them download, if they dont and they click yes...user
error.

MattC
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top