View excel file in page

Hi, im building an intranet file viewer and i need to open excel, pdf
etc… in asp page, but it doesnt seem to work, any ideas why any of
this options dont work?

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "">
<html xmlns="" xml:lang="en" lang="en">
<head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<object  width="900px" height="500px" id="excel"  data="c:/Users/RS/babywebssl/Ficheiros/ficheiros/Agosto/Relatorio_Agosto.xlsx" classid="clsid:0002E55a-0000-0000-C000-000000000046" VIEWASTEXT  >
<param name="DisplayTitleBar" value="true" />
<param name="DataType" value="CSVURL"/>
<param name="AutoFit" value="0"/>
<param name="DisplayColHeaders" value="1"/>
<param name="DisplayGridlines" value="1"/>
<param name="DisplayHorizontalScrollBar" value="1"/>
<param name="DisplayRowHeaders" value="1"/>
<param name="DisplayTitleBar" value="1"/>
<param name="DisplayToolbar" value="1"/>
<param name="DisplayVerticalScrollBar" value="1"/>
<param name="EnableAutoCalculate" value="0"/>
<param name="EnableEvents" value="0"/>
<param name="MoveAfterReturn" value="1"/>
<param name="MoveAfterReturnDirection" value="0"/>
<param name="RightToLeft" value="0"/>


<iframe src="http://file:///c:/Users/RS/babywebssl/Ficheiros/ficheiros/Agosto/Relatorio_Agosto.xlsx" width="100%" height="500"></iframe>


Iv tried with http://file.path, http://file:///file.path or just file.path and nothing.

Here’s an easy way for you to tell. Are your PDFs/excel spreadsheets in the same folder as your HTML file?

E.g. lets say your HTML file is this and your PDF is called PDF-file.pdf


That’s just a random HTML page I created and opened in Chrome (or any browser). Copy that URL and then replace asdf.html with whatever your PDF is called. E.g. PDF-file.pdf

Alternatively you could just relatively link it. So if your PDF file is in the same folder as your HTML page, remove hte file:/// and http:// stuff and ONLY put “PDF-file.pdf” in your file name. It’ll look for that file in the same folder as your HTML file.

Thanks for the reply the file is in subfolder where the html is, i use the full path and nothing

Then don’t use the full path. As I said, use relative. Probably better that way anyway.

tried with full path, server.mappath and path from asp page and always get the The address wasn’t understood message, but when i print the path it prints the correct path.

What do you mean the address wasn’t understood? 404? 404’s mean the file wasn’t found.

you can see a print of the error

It looks like you have the name wrong. I don’t see any PDF reference in your above code, so can you show us what code is used for the PDF? Along with what the actual file name is in yoru folder?

You’re using HTTP protocol. Use the path accordingly. Those path have to be reached by the IIS server, not by Windows explorer.

HTTP doesn’t understand of units such as C:. They understand things like IP addresses for a server, relative paths and things like that… Try that and let us know how it works

its working, but i need to split the full path, im trying with replace but it gives error, is there any error in this replace?

caminho1 =Replace (caminho,“dsk”,“http://localhost:85/”)

forget it, its working now, just had to remoce “” on dsk.

now can anyone know how i remove the top bar on the pdf?

What do you mean with top bar? If the file is open in the browser, you shouldn’t have one. It may be a case of configuration of Adobe Reader, though. It affects on how the PDF is displayed in the browser (that is, if you’re using Adobe Reader’s plugin)

i need to disable this

That is part of the PDF reader so you can’t disable it completely unless you have access to the reader plugin on each specific computer where you want to disable it. Then assuming that the plugin has an option for disabling it then you will be able to disable it for all PDFs displaying in that browser on that computer.

I don’t know if there is an option to disable it as I haven’t come across a situation where anyone wants to block their own ability to print, save or zoom PDFs displayed in their browser. Not that doing so would prevent them from being able to open the downloaded copy of the PDF in a stand alone PDF editor or reader and zoom from there.

You can encrypt and then password protect a PDF so that only those who know the password can print it. That will not disable the print button but it will then ask for the password before allowing the file to print. There are programs around that can bypass this so doing so will not prevent everyone from being able to print but it will prevent most.

To the best of my knowledge there is nothing you can do to the PDF itself to prevent the save or zoom options from working.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.