-
Notifications
You must be signed in to change notification settings - Fork 297
Header and Footer
JanKallman edited this page Oct 19, 2023
·
13 revisions
Headers and Footers of printed worksheets are set via the ExcelWorksheet.HeaderFooter property.
using(var package = new ExcelPackage())
{
var sheet = package.Workbook.Worksheets.Add("Sheet1");
// add a logo to upper left corner
using(var fs = new FileStream(@"c:\images\myLogo.jpg", FileMode.Open))
{
var drawing = sheet.HeaderFooter.OddHeader.InsertPicture(fs, ePictureType.Jpg, PictureAlignment.Left);
// you can use the drawing instance to change Height, Width, etc.
}
// add todays date to the upper right corner
sheet.HeaderFooter.OddHeader.RightAlignedText = ExcelHeaderFooter.CurrentDate;
}See Sample 1.1-C# or sample 1.1-VB for more examples on how to add headers/footers.
EPPlus Software AB - https://epplussoftware.com
- What is new in EPPlus 5+
- Breaking Changes in EPPlus 5
- Breaking Changes in EPPlus 6
- Breaking Changes in EPPlus 7
- Breaking Changes in EPPlus 8
- Addressing a worksheet
- Dimension/Used range
- Copying ranges/sheets
- Insert/Delete
- Filling ranges
- Sorting ranges
- Taking and skipping columns/rows
- Data validation
- Comments
- Freeze and Split Panes
- Header and Footer
- Hyperlinks
- Autofit columns
- Grouping and Ungrouping Rows and Columns
- Formatting and styling
- The ExcelRange.Text property
- Conditional formatting
- Using Themes
- Working with custom named table- or slicer- styles