C# Print Headers and Footers SpreadsheetGear API SampleExcel-Compatible Samples for .NET Other C# API SamplesDescriptionDemonstrates using various codes to add content and formatting to the Print Headers and Footers, including adding an embedded picture.Sample C# Source Code// Open workbook with some sample data. SpreadsheetGear.IWorkbook workbook = SpreadsheetGear.Factory.GetWorkbook(@"Files\HeadersAndFootersSampleData.xlsx"); SpreadsheetGear.IWorksheet worksheet = workbook.ActiveWorksheet; // Get page setup object for the worksheet. SpreadsheetGear.IPageSetup pageSetup = worksheet.PageSetup; // Load picture into byte array (would also accept a path to a file). byte[] pictureBytes = System.IO.File.ReadAllBytes(@"Files\SpreadsheetGearLogo.png"); // Add picture into Left Header and specify picture code (&G) to render it. pageSetup.LeftHeaderPicture.Add(pictureBytes, 32, 32); pageSetup.LeftHeader = "&G"; // Specify Center Header text, also applying to it Bold (&B), Underline (&U) and // Arial 16pt (&16&"Arial"). pageSetup.CenterHeader = @"&B&U&16&""Arial""SpreadsheetGear Report"; // Setup Right Header with Current Page Number (&P) and Total Page Count (&N). pageSetup.RightHeader = "Page &P of &N"; // Setup Left Footer with current Date (&D) and Time (&T). pageSetup.LeftFooter = "&D &T"; // Setup Right Footer, in Italics (&I), with Workbook Name (&F) and Worksheet // Name (&A). pageSetup.RightFooter = "&I'&F'!&A";