Skip to footer content
EXCEL TOOLS

How to Print an Excel Spreadsheet (.NET10 & C#)

If you have ever tried to print an Excel spreadsheet only to find that your clean, carefully organized table was sliced into dozens of floating columns across endless pages, you are not alone. Getting an Excel file to render cleanly on physical paper or PDF is a common hurdle for office professionals and developers alike.

Whether you need to fit a massive worksheet onto a single page, repeat header rows across multiple pages, or automate report generation in software applications, this comprehensive guide covers every essential step and setting.

The Quickest Method: Using Print Preview in Excel

Before sending any document to your printer, opening the print preview screen is your best defense against wasted paper and cut-off columns.

Step-by-Step Instructions

  1. Open your Excel spreadsheet and click on the File tab in the top menu bar.
  2. Select Print (or press Ctrl + P on Windows / Cmd + P on Mac).

     related to Step-by-Step Instructions

  3. Review your document on the print preview panel on the right side of the screen.

    Customize settings and print

Step 1: Set Page Orientation and Margins

Wide Excel spreadsheets often overflow standard vertical pages. Changing the page orientation and adjusting page margins can immediately fix formatting issues.

Changing Page Orientation

  1. Click on the Page Layout tab in the top ribbon.

     related to Changing Page Orientation

  2. In the Page Setup group, click the Orientation button.
  3. Choose Landscape Orientation for wide data or Portrait Orientation for tall reports.

    Adjust the orientation

Adjusting Margins

  • Under the Page Layout tab, locate the setup group.
  • Click Margins and choose Narrow Margins to increase the printable area on your paper.

    Page margins settings

  • Alternatively, click Custom Margins at the bottom to open the Page Setup dialog box for exact measurements.
  • Margin Preset Top / Bottom Left / Right Best Used For
    Normal 0.75 in 0.70 in Standard office documents
    Wide 1.0 in 1.0 in Formally bound printouts and presentations
    Narrow 0.75 in 0.25 in Fitting extra columns on a single page

    Step 2: Fit an Entire Excel Spreadsheet on One Page

    When working with wide datasets, forced page breaks can split vital information across pages. Excel provides built-in scaling options to force data onto a single sheet.

    Using the Scaling Dropdown

    1. Navigate to File > Print to open the print options.
    2. Click the bottom dropdown menu under Settings (defaults to "No Scaling").
    3. Choose Fit Sheet on One Page to scale both rows and columns onto one page.
    4. To shrink only the width while allowing rows to flow naturally downward, select Fit All Columns on One Page.

    Step 3: Manage Page Breaks Visually

    To see exactly where Excel splits your data across physical pages, switch to Page Break Preview mode.

    1. Click the View tab on the ribbon.
    2. Select Page Break Preview from the Workbook Views section.
    3. Blue lines will appear over your Excel sheet:

      • Dashed blue lines represent automatic page breaks calculated by Excel.
      • Solid blue lines represent manual page breaks.
    4. Click and drag any blue line left, right, up, or down to adjust page boundaries visually.

    Step 4: Define the Print Area or Select Specific Sheets

    You don't always need to print an entire worksheet or the entire workbook. You can print specific cells or multiple worksheets simultaneously.

    Setting a Specific Print Area

    1. Highlight the cells you want to print using your mouse.

      Highlight cells

    2. Go to the Page Layout tab > Page Setup group.
    3. Click Print Area and select Set Print Area.

       related to Setting a Specific Print Area Set Print Area" />

    Printing Selected Worksheets

    • Print Active Sheets: Default setting; prints the currently open sheet.
    • Print Selection: Highlight a specific range, go to File > Print, and change "Print Active Sheets" to Print Selection.
    • Print Multiple Worksheets: Hold Ctrl (or Cmd on Mac) and click each sheet tab along the bottom of your Excel file. Then go to File > Print, Excel will combine all selected sheets into one print job.

    Programmatic Automation with IronXL

    While adjusting settings manually through the Microsoft Excel user interface works for individual reports, it doesn't scale for enterprise server environments, background processing, or bulk document creation.

    If you need to programmatically configure print setups, generate PDFs, or manipulate spreadsheet layouts without Microsoft Office installed, IronXL provides a complete solution for .NET applications.

    IronXL is an intuitive .NET library that allows developers to read, generate, format, and export Excel spreadsheets using C#, VB.NET, or F#. It supports standard .xlsx, .xls, .csv, and .xml formats, enabling automation of print scaling, page orientation, headers, and document margins.

    Key Capabilities for Print Management

    • Page Setup Control: Programmatically set portrait or landscape orientation, paper size, and custom margins.
    • Scaling & Fitting: Configure fit-to-page settings directly in code before exporting to PDF or sending to print spoolers.
    • Cross-Platform Execution: Fully supported on Windows, macOS, Linux, Docker, and Azure cloud environments.

    Generating Print-Ready Spreadsheets in C#

    The following example demonstrates how to create a workbook, populate data, configure page orientation and print titles, and export it for clean output:

    using IronXL;
    
    // Load an existing excel file or create a new entire workbook
    WorkBook workbook = WorkBook.Create(ExcelFileFormat.XLSX);
    WorkSheet worksheet = workbook.DefaultWorkSheet;
    
    // Populate sample data in the excel sheet
    worksheet["A1"].Value = "Quarterly Sales Report";
    worksheet["A2"].Value = "Region";
    worksheet["B2"].Value = "Revenue";
    worksheet["A3"].Value = "North America";
    worksheet["B3"].Value = 150000;
    
    // Access the correct PrintSetup object to configure the page tab layout
    worksheet.PrintSetup.PrintOrientation = PrintOrientation.Landscape;
    worksheet.PrintSetup.PaperSize = PaperSize.A4;
    
    worksheet.PrintSetup.HeaderMargin = 0.5;
    worksheet.PrintSetup.FooterMargin = 0.5;
    
    //Apply thin borders directly to your used range so lines appear on the printed page.
    var dataRange = worksheet["A1:B3"];
    dataRange.Style.BottomBorder.Type = IronXL.Styles.BorderType.Thin;
    dataRange.Style.TopBorder.Type = IronXL.Styles.BorderType.Thin;
    dataRange.Style.LeftBorder.Type = IronXL.Styles.BorderType.Thin;
    dataRange.Style.RightBorder.Type = IronXL.Styles.BorderType.Thin;
    
    // Save the completely formatted excel file 
    workbook.SaveAs("PrintReadyReport.xlsx");
    using IronXL;
    
    // Load an existing excel file or create a new entire workbook
    WorkBook workbook = WorkBook.Create(ExcelFileFormat.XLSX);
    WorkSheet worksheet = workbook.DefaultWorkSheet;
    
    // Populate sample data in the excel sheet
    worksheet["A1"].Value = "Quarterly Sales Report";
    worksheet["A2"].Value = "Region";
    worksheet["B2"].Value = "Revenue";
    worksheet["A3"].Value = "North America";
    worksheet["B3"].Value = 150000;
    
    // Access the correct PrintSetup object to configure the page tab layout
    worksheet.PrintSetup.PrintOrientation = PrintOrientation.Landscape;
    worksheet.PrintSetup.PaperSize = PaperSize.A4;
    
    worksheet.PrintSetup.HeaderMargin = 0.5;
    worksheet.PrintSetup.FooterMargin = 0.5;
    
    //Apply thin borders directly to your used range so lines appear on the printed page.
    var dataRange = worksheet["A1:B3"];
    dataRange.Style.BottomBorder.Type = IronXL.Styles.BorderType.Thin;
    dataRange.Style.TopBorder.Type = IronXL.Styles.BorderType.Thin;
    dataRange.Style.LeftBorder.Type = IronXL.Styles.BorderType.Thin;
    dataRange.Style.RightBorder.Type = IronXL.Styles.BorderType.Thin;
    
    // Save the completely formatted excel file 
    workbook.SaveAs("PrintReadyReport.xlsx");
    Imports IronXL
    
    ' Load an existing excel file or create a new entire workbook
    Dim workbook As WorkBook = WorkBook.Create(ExcelFileFormat.XLSX)
    Dim worksheet As WorkSheet = workbook.DefaultWorkSheet
    
    ' Populate sample data in the excel sheet
    worksheet("A1").Value = "Quarterly Sales Report"
    worksheet("A2").Value = "Region"
    worksheet("B2").Value = "Revenue"
    worksheet("A3").Value = "North America"
    worksheet("B3").Value = 150000
    
    ' Access the correct PrintSetup object to configure the page tab layout
    worksheet.PrintSetup.PrintOrientation = PrintOrientation.Landscape
    worksheet.PrintSetup.PaperSize = PaperSize.A4
    
    worksheet.PrintSetup.HeaderMargin = 0.5
    worksheet.PrintSetup.FooterMargin = 0.5
    
    ' Apply thin borders directly to your used range so lines appear on the printed page.
    Dim dataRange = worksheet("A1:B3")
    dataRange.Style.BottomBorder.Type = IronXL.Styles.BorderType.Thin
    dataRange.Style.TopBorder.Type = IronXL.Styles.BorderType.Thin
    dataRange.Style.LeftBorder.Type = IronXL.Styles.BorderType.Thin
    dataRange.Style.RightBorder.Type = IronXL.Styles.BorderType.Thin
    
    ' Save the completely formatted excel file 
    workbook.SaveAs("PrintReadyReport.xlsx")
    $vbLabelText   $csharpLabel

    IronXL Output

    IronXL Output

    Method Comparison

    Option Ideal Use Case Setup Speed Automation Potential
    Excel Ribbon (Page Layout) One-off manual document printing Fast None (Manual)
    Print Preview Settings Quick scaling or margin tweaks Very Fast None (Manual)
    Page Break Preview Custom visual layout control Moderate None (Manual)
    IronXL (.NET Library) Automated server-side PDF/Print generation High Efficiency Fully Automated

    Summary

    Mastering how to print an Excel spreadsheet comes down to using the right layout tools for the task. For quick manual printouts, use Print Preview, select Landscape Orientation, adjust your margins, or use the Page Break Preview mode to manage page breaks. For recurring reports, set Print Titles to keep column headers visible on every single page.

    When manual adjustments are no longer practical for your workflow, libraries like IronXL give developers full programmatical control over page setup, orientation, and scaling across hundreds of workbooks automatically.

    Ready to take your Excel workflows to the next level? Try the IronXL free trial today and see how easy it is to automate and manage complex spreadsheets directly with code!

    Curtis Chau
    Technical Writer

    Curtis Chau holds a Bachelor’s degree in Computer Science (Carleton University) and specializes in front-end development with expertise in Node.js, TypeScript, JavaScript, and React. Passionate about crafting intuitive and aesthetically pleasing user interfaces, Curtis enjoys working with modern frameworks and creating well-structured, visually appealing manuals.

    ...

    Read More

    Iron Support Team

    We're online 24 hours, 5 days a week.
    Chat
    Email
    Call Me