5

I have a file hosted on AWS Linux AMI. The link is http://54.179.188.146/a/a.docx I can visit the link and download the file.

I am trying to use Microsoft Online Doc Viewer to view the Word File online at this link https://view.officeapps.live.com/op/view.aspx?src=http://54.179.188.146/a/a.docx but it returns a page stating "An error occurred We're sorry, but for some reason we can't open this for you."

I had chmod the file to 775 but it still cannot view.

I had uploaded to another server and it is working. May I know what is wrong? Is it a server configuartion issue? Please advise.

Thanks.

Derek Lim
  • 321
  • 1
  • 3
  • 14

3 Answers3

7

This is Old but giving some more pointers to the new visitors , i am posting the consolidated answer for the root cause of the "We’re sorry, but for some reason we can’t open this for you" error in https://view.officeapps.live.com/op/view.aspx?src=

If you see the error, "We’re sorry, but for some reason we can’t open this for you," it means the document could not be found or could not be displayed. Likely reasons include:

  • There’s no document to be found at the URL you provided. Make sure you provide the correct URL.
  • The document is too large. Word and PowerPoint documents must be less than 10 megabytes; Excel must be less than five megabytes.
  • The document was not saved in a format that is supported for opening in a web browser. Try saving your document in one of the following formats:
    • Word: docx, docm, dotm, dotx
    • Excel: xlsx, xlsb, xls, xlsm
    • PowerPoint: pptx, ppsx, ppt, pps, pptm, potm, ppam, potx, ppsm
  • You need to sign in or provide a password to open the document. Make the document publically available to view.
  • The document’s file name contains invalid characters. Try encoding the file name when you type the document’s URL, or rename the file to use only letters and numbers. For example, to encode a URL that includes an ampersand (i.e. &), you would type %26 for the ampersand character. For more information about URL encoding, also known as percent encoding.

more info can be found here

Sᴀᴍ Onᴇᴌᴀ
  • 8,218
  • 8
  • 36
  • 58
King of Masses
  • 18,405
  • 4
  • 60
  • 77
  • 1
    To add to this list of reasons, I got this error when using the public IP address of a host. Using a hostname resolved this error. – Strake Feb 12 '18 at 23:35
  • 1
    checked all of them, still not working – Boris Gafurov Dec 20 '22 at 20:13
  • We're using encoded AWS S3 presigned URLs. The PPTX file is less than 1 MB, so all of the boxes above should be checked, but still not working. – DV82XL Jul 23 '23 at 00:02
4

The value after "src=" should be URL-encoded. See details on MS Page

2

You should checked all reasons from here

  • There’s no document to be found at the URL you provided. Make sure you provide the correct URL.
  • Try to open file from browser.

  • Make sure you don't try to send on preview service path of the file from your local host. To which, obviously, there is no access from the Internet.

  • Path to file must be http:// or https://

  • If path to your file start with https:// make sure your site have necessary secure certificate.

  • Domain name matters.

Will not be open in preview service

http://185.231.70.200/vacuumcleanerprocedure.doc

Will be open in preview service

http://domainname.com/vacuumcleanerprocedure.doc
  • The document is too large. Word and PowerPoint documents must be less than 10 megabytes; Excel must be less than five megabytes.

Try different files with different Microsoft file types.

  • The document was not saved in a format that is supported for opening in a web browser. Try saving your document in one of the following formats: Word: docx, dotx Excel: xlsx, xlsb, xls, xlsm PowerPoint: pptx, ppsx, ppt, pps, potx, ppsm

Try different files with different Microsoft file types.

  • You need to sign in or provide a password to open the document. Make the document publicly available to view.

File permission and folders mode should be 775.

Check if in .htaccess file of your apache server there are allow access to ms-office files.

Check if your file available from internet. Try to open file from browser. If you see “You don't have permission to access filename on this server” see answer here

  • The document’s file name contains invalid characters. Try encoding the file name when you type the document’s URL, or rename the file to use only letters and numbers. For example, to encode a URL that includes an ampersand (&), you would type %26 for the ampersand character. For more information about URL encoding, also known as percent encoding, see Percent-encoding on Wikipedia.

The value after "src=" should be URL-encoded. When you place the link on the preview service, it already encodes it for preview. Additionally, I may encode the link here, but the result will be the same.

Eric Korolev
  • 713
  • 8
  • 13