다음을 통해 공유


SharePoint Modern Sites: How To Open Selected Document In File Viewer (Word, Excel, PowerPoint And PDF) (Part 1)

Introduction 

In my previous article, I already explained how to open Office apps (Word, Excel, and PowerPoint) files and view in an iframe (classic mode).

Here, let us see about using modern web parts, and how we can view the selected document without any customization using File Viewer. 

Scenario 

Users may not be able to open documents on their client machine. Unfortunately, the default content provides a link which only allows users to download the document and provides a link back to the document file and open in the new tab of the browser window. We must find the downloaded document in a manual fashion. 

The requirement is to open the selected document without downloading on a local machine and open it in a new tab of the browser window and this should be achieved using Modern in OOB web parts. 

Objective 

The below OOB web parts will be used in this solution.

  1. Document library - Show document library files 
  2. File Viewer - The web part will allow users to view files directly in the page without needing to open the file. 

Follow the below steps.

Step 1

Navigate to your SharePoint 2013 site -> Create Modern Page in Site Pages.

Step 2

From this page,

Step 3

You will see two sections to add web parts,

https://www.c-sharpcorner.com/article/how-open-selected-document-in-file-viewer-word-excel-power-point-and-pdf-in/Images/How%20Open%20Selected%20Document%20In%20File%20Viewer%20In%20SharePoint%20Modern%20Sites02.png

Step 4

Final Step

  • Select any File from the left side document library
  • The file should be opened in the right side File viewer web part

Without Selected File Screen

https://www.c-sharpcorner.com/article/how-open-selected-document-in-file-viewer-word-excel-power-point-and-pdf-in/Images/How%20Open%20Selected%20Document%20In%20File%20Viewer%20In%20SharePoint%20Modern%20Sites10.png

With Selected File Screen

https://www.c-sharpcorner.com/article/how-open-selected-document-in-file-viewer-word-excel-power-point-and-pdf-in/Images/How%20Open%20Selected%20Document%20In%20File%20Viewer%20In%20SharePoint%20Modern%20Sites11.png