Printing Problems

How to Fix Excel Printing and Scaling in C# Interop Workbooks

John WilsonJohn Wilson Nov 2, 2026 870 views

Question details

The user needs to configure an Excel workbook generated via C# Interop to print on a single page instead of spanning across multiple pages.

How to Fix Excel Printing and Scaling in C# Interop Workbooks
Product
Microsoft Excel (C# Interop)
Device & OS
not provided
Scenario
Generating an Excel workbook programmatically using C# and attempting to print or export it to PDF.
Observed behavior
The generated workbook prints across two or more pages, failing to automatically scale row heights, font sizes, or layout to fit on one page.
Before you start

Ensure you have added the appropriate Microsoft.Office.Interop.Excel reference to your C# project and that your target machine has Excel installed for the Interop to function.

Solution 1Recommended

Configure PageSetup Properties for Fit to Page in C#

Use the Excel Interop PageSetup object in your C# code to force the worksheet to scale and fit on a single printed page.

When automating Excel via C#, the default print settings will print at 100% scale. To force the content to fit on one page, you must explicitly disable the Zoom property and define the FitToPagesWide and FitToPagesTall properties.

1
Access the PageSetup object

In your C# code, reference the worksheet's PageSetup property: `Excel.PageSetup pageSetup = worksheet.PageSetup;`

2
Disable the Zoom property

Set the zoom to false so Excel allows the fit-to-page settings to take effect: `pageSetup.Zoom = false;`

3
Set horizontal scaling

Force the worksheet to fit exactly one page wide: `pageSetup.FitToPagesWide = 1;`

4
Set vertical scaling

Force the worksheet to fit exactly one page tall (or set it to false if you only want to constrain width): `pageSetup.FitToPagesTall = 1;`

Configure PageSetup Properties for Fit to Page in C#
Developer Resources: For more complex programmatic layout issues, consider posting on Microsoft Q&A where developers share detailed C# and Excel Interop configurations.
Free Microsoft Office alternative

Try WPS Office for Lightweight Spreadsheet Management

If you frequently work with Excel files and need a fast, reliable, and free alternative, WPS Office provides excellent compatibility with Microsoft Office formats, including robust print layout controls and API automation capabilities.

Fully compatible with Microsoft Excel (.xlsx, .xls) formatsLightweight application that opens large datasets quickly and cleanlyBuilt-in intuitive 'Fit to Page' print scaling features right from the print previewIncludes a COM API similar to Microsoft's for automation and development
microsoft office alternative - wps office

Frequently Asked Questions

Why is my Excel Interop PageSetup.FitToPagesWide code being ignored?

The FitToPagesWide and FitToPagesTall properties will be completely ignored by Excel unless you explicitly set the Zoom property of the PageSetup object to false (`pageSetup.Zoom = false;`).

Can I use C# Interop to auto-fit row heights and column widths before printing?

Yes, you can optimize the cell sizes before setting the print scaling. Call `worksheet.Columns.AutoFit();` and `worksheet.Rows.AutoFit();` on your target range in your C# code before applying the PageSetup commands.

Does WPS Office support COM Interop automation like Microsoft Excel?

WPS Office offers its own COM API that is highly structurally compatible with Microsoft Excel's VBA and Interop models. Developers can often port their automation scripts to WPS Office with minimal code adjustments.