I am trying to display different kinds of files inside a iframe. It works for text, images and pdf files but not working with MS office or Open office documents. Is there a way to do this? Also, it automatically starts to download files that cannot be opened, is there a way to stop this automatic download from happening?
I am trying to display different kinds of files inside a iframe. It works for text, images and pdf files but not working with MS office or Open office documents. Is there a way to do this? Also, it automatically starts to download files that cannot be opened, is there a way to stop this automatic download from happening?
Share edited Sep 11, 2015 at 6:39 pnuts 59.6k11 gold badges91 silver badges141 bronze badges asked Aug 7, 2014 at 19:50 user3919835user3919835 291 silver badge2 bronze badges2 Answers
Reset to default 3Microsoft now provides a nice web viewer, explained here
It only works on files that are publicly available at some http endpoint, but thankfully, they do let you stick it an the iframe. Just append your filename as the src of this link:
view.officeapps.live./op/view.aspx?src=
A more interesting solution to me is to look around for ways to use open office on the mand line. It has a capability to convert microsoft documents into open office format, at which point you can use the open source http://viewerjs/ and host it yourself if that's your style.
Just make the src
attribute in your IFrame
refer to a direct link for the PDF, such as
https://docs.google./viewer?embedded=true&url={DirectPdfUrl}
, where DirectPdfUrl
is a direct link to the PDF file (must be accessible over the internet, not locally!)
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744918778a4600999.html
评论列表(0条)