How to Resize the SharePoint File Viewer Web Part
Question details
Users need a way to resize the SharePoint File Viewer web part so that it properly matches the displayed document's dimensions.

- Product
- SharePoint
- Device & OS
- not provided
- Scenario
- Displaying a document on a SharePoint site page and attempting to adjust the viewer window to prevent awkward scrolling or layout issues.
- Observed behavior
- SharePoint lacks a built-in option to resize the File Viewer web part natively, causing limitations in how documents are presented on modern site pages.
Ensure you have editing permissions for the SharePoint site page and have access to the document you wish to display.
Use the Embed Web Part as a Workaround
Since the native File Viewer cannot be freely resized, using the Embed web part allows you to manually specify custom dimensions using iframe attributes.
The Embed web part acts as an alternative by allowing you to inject HTML iframe codes directly onto your SharePoint page. This gives you manual control over the width and height properties.
Navigate to the document in your SharePoint document library or OneDrive. Open the file, click on 'File', select 'Share', and then choose 'Embed'. Copy the provided iframe code.
Go to the SharePoint site page where you want to display the document and click 'Edit' in the top-right corner to enter edit mode.
Hover over the canvas, click the '+' icon to add a new web part, and select 'Embed' from the available list of web parts.
Paste your copied iframe code into the Embed web part's property pane. Locate the 'width' and 'height' attributes in the code (e.g., width="100%" height="600px") and modify them to your desired size, then republish the page.

Seek Custom Code Solutions or Submit Feedback
If the Embed workaround does not meet your organization's needs, consider developer solutions or advocating for native features.
Experience Superior Document Processing with WPS Office
While SharePoint web parts have display limitations online, your local document editing shouldn't be restrictive. WPS Office is a free, lightweight Microsoft Office alternative offering comprehensive format compatibility, a familiar UI, and a seamless migration path for all your document needs.
- 1. Download the software: Visit the official WPS Office website to download the free installation package tailored for your operating system.
- 2. Install quickly: Run the lightweight installer and follow the straightforward prompts to set up the software in just a few minutes.
- 3. Edit your files seamlessly: Launch WPS Office and open your existing Office files instantly without losing any layout or formatting data.

Frequently Asked Questions
Can I make the SharePoint File Viewer web part auto-resize based on document length?
Currently, SharePoint does not offer a native auto-resize feature for the File Viewer. The web part maintains a fixed default container size, requiring users to scroll vertically for longer documents.
What is the primary difference between the File Viewer and Embed web parts in SharePoint?
The File Viewer is specifically designed for displaying Office files and PDFs directly with native Microsoft controls but has limited layout adjustments. The Embed web part allows you to use customized iframe codes, giving you explicit manual control over the container's height and width attributes.
Will modifying the iframe width and height in the Embed web part distort my document?
No, changing the dimensions in the Embed web part only changes the outer viewer window size, not the document's internal aspect ratio. The document will scale or provide scrollbars accordingly based on the space available.




