IRONSOFTWAREHOME
Excel Print Setup
using IronXL;
using IronXL.Printing;

WorkBook workBook = WorkBook.Load("sample.xlsx");
WorkSheet workSheet = workBook.DefaultWorkSheet;

// Set the print header and footer of the worksheet
workSheet.Header.Center = "My document";
workSheet.Footer.Center = "Page &P of &N";

// Set the header margin
workSheet.PrintSetup.HeaderMargin = 2.33;

// Set the size of the paper
// Paper size enum represents different sizes of paper
workSheet.PrintSetup.PaperSize = PaperSize.B4;

// Set the print orientation of the worksheet
workSheet.PrintSetup.PrintOrientation = PrintOrientation.Portrait;

// Set black and white printing
workSheet.PrintSetup.NoColor = true;

workBook.SaveAs("PrintSetup.xlsx");
Imports IronXL
Imports IronXL.Printing

Dim workBook As WorkBook = WorkBook.Load("sample.xlsx")
Dim workSheet As WorkSheet = workBook.DefaultWorkSheet

' Set the print header and footer of the worksheet
workSheet.Header.Center = "My document"
workSheet.Footer.Center = "Page &P of &N"

' Set the header margin
workSheet.PrintSetup.HeaderMargin = 2.33

' Set the size of the paper
' Paper size enum represents different sizes of paper
workSheet.PrintSetup.PaperSize = PaperSize.B4

' Set the print orientation of the worksheet
workSheet.PrintSetup.PrintOrientation = PrintOrientation.Portrait

' Set black and white printing
workSheet.PrintSetup.NoColor = True

workBook.SaveAs("PrintSetup.xlsx")
NuGet Download
PM > Install-Package IronXL.Excel
Excel Print Setup

Excel Print Setup

The Excel Print Setup feature in IronXL allows developers to easily configure print settings for Excel worksheets before printing or saving them. This feature is particularly useful when generating reports, invoices, or documents that need specific formatting for printing. Developers can set custom headers and footers to include dynamic content like page numbers, titles, and other details, ensuring a professional output. The PrintSetup options also allow fine-tuning of print margins, paper size, and orientation, making it possible to adapt the document for various printers and paper types.

IronXL gives developers full control over how the printed document will appear with the ability to specify paper sizes such as B4, A4, or letter sizes, as well as orientation options (portrait or landscape). Additionally, the ability to switch to black-and-white printing or disable color adds flexibility, especially for cost-effective printing scenarios. This feature streamlines the process of preparing Excel files for high-quality printed output.

Learn More About Managing Excel Worksheets in C#
View on GitHub

Ready to Get Started?

Nuget Downloads 2,237,574Version:2026.9just released

Key in blue circle

Get your free 30-day Trial Key instantly.

Your trial license will be sent to your email address

No limitations. 100% unlocked. No credit card.

bullet_checkedNo credit card or account creation requiredNo limitations. 100% unlocked. No credit card.
  • Logo Aetna
  • Logo NASA
  • Logo GE
  • Logo Porsche
  • Logo USDA
  • Logo Qatar
Join Millions of Engineers who’ve tried IronPDF
Book your free Live Demo
Booking Badge

Trusted by Millions of Engineers Worldwide

Iron Software's customer logos
Get Your No-Obligation Consult
Complete the form below or email sales@ironsoftware.com
Your details will always be kept confidential.
Trusted by Millions of Engineers Worldwide
Iron Software's customer logos
Get your free 30-day Trial Key instantly.
No credit card or account creation required