How does SharePoint share Office files and PDF files without downloading them

sharepoint.stackexchange https://sharepoint.stackexchange.com/questions/246366

  •  21-01-2021
  •  | 
  •  

سؤال

How does SharePoint display an office document or PDF in a browser without requiring a download? I have seen some information on the WopiFrame and was wondering if there was a way to display office documents without having to require a download or if there is a way to "emulate" this behavior outside of sharepoint

هل كانت مفيدة؟

المحلول

This feature is (now formerly) known as Office Web Apps for on premises installations. For SP Online, it’s known as Office Online (also see here) and acts as an integrated feature that is set to ‘on’ by default.

SharePoint on premise and SharePoint Online both have a server-side document processing system that will parse the contents of documents and render the output as HTML. This has been available since the release of SharePoint 2010.

For SharePoint 2013 and later, Microsoft de-coupled the server-side document processing system from SharePoint itself and released it as a free, stand alone install which had to be installed on a separate server from the one SharePoint itself was installed on.

The protocol used to communicate between the client and server is WOPI (Web application Open Platform Interface). Typically, the office document or PDF is rendered in an Iframe which takes up most or all of the webpage’s surface (as when a user is editing or viewing the document).
When you click on the ellipses next to a document title, in the popover that appears, a document preview will also render in an iframe.

If configuring Office Web Apps on premise, it is possible to also coerce the Word Document parsing engine to parse most PDF files and output it as HTML using PowerShell. (All configuration for on premise implementations of Office Web Apps is performed via PowerShell)

The reason the file does not download is two-fold:

  1. The default file handler for the HTML MIME Type emitted for an HTML page (which is what the document is rendered as) - is the Web browser. So that is one reason the file itself is not downloaded to the client.

  2. Also, the “View Documents in Browser” feature has not been disabled (hence #1). You can disable the display and editing of Office documents in the browser at either the document library level or at the site (web) level.

I hope that this answers your question.

نصائح أخرى

I don't have an image example for you as we are on an older version of SP, however I know you can get an iFrame for office documents now. In SharePoint the option is usually there under the ellipsis (...), or on online documents (stored in the OneDrive) under "share" will have an option for the iFrame. I believe it's format-able to be edited in the iFrame or be just "read only".

The path for the iFrame from OneDrive is... Open in Word Online > File > Share > embed, then you can change some settings and just paste the iFrame in any script editor webpart or in the source of the page you're on.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى sharepoint.stackexchange
scroll top