Every ByteScout tool contains example C# source codes that you can find here or in the folder with installed ByteScout product. ByteScout Spreadsheet SDK is the SDK that can write and read, modify and calculate Excel and CSV spreadsheets. Most popular formulas are supported. You may import or export data to and from CSV, XML, JSON as well as to and from databases, arrays and you can use it to add header and footer for spreadsheet with C#.
C# code samples for C# developers help to speed up coding of your application when using ByteScout Spreadsheet SDK. In order to implement the functionality, you should copy and paste this code for C# below into your code editor with your app, compile and run your application. Test C# sample code examples whether they respond your needs and requirements for the project.
Free trial version of ByteScout Spreadsheet SDK is available on our website. Documentation and source code samples are included.
On-demand (REST Web API) version:
Web API (on-demand version)
On-premise offline SDK for Windows:
60 Day Free Trial (on-premise)
using System; using System.Diagnostics; using System.IO; using Bytescout.Spreadsheet; namespace AddHeaderAndFooter { class Program { static void Main(string[] args) { try { // Create new Spreadsheet object Spreadsheet spreadsheet = new Spreadsheet(); // Add new worksheet Worksheet worksheet = spreadsheet.Workbook.Worksheets.Add("Sample"); // Add headers: // add date as left header worksheet.PageSetup.LeftHeader = "&D"; // add label with custom font as center header worksheet.PageSetup.CenterHeader = "&\"Verdana,bold\"&14Laws && Rights"; // add time as right header worksheet.PageSetup.RightHeader = "&T"; // Add footers: // add file name as left footer worksheet.PageSetup.LeftFooter = "&F"; // add "page of pages" indicator as center footer worksheet.PageSetup.CenterFooter = "&P/&N"; // add simple text as right footer worksheet.PageSetup.RightFooter = "Right footer"; // Add worksheet content worksheet.Cell(1, 1).Value = "Click Print Preview to see headers and footers."; // Save it as XLS if (File.Exists("Output.xls")) File.Delete("Output.xls"); spreadsheet.SaveAs("Output.xls"); // Close the document spreadsheet.Close(); // Open output XLS file Process.Start("Output.xls"); } catch (Exception e) { Console.WriteLine(e.ToString()); Console.WriteLine("\nPress any key to exit..."); Console.ReadKey(); } } } }
60 Day Free Trial or Visit ByteScout Spreadsheet SDK Home Page
Explore ByteScout Spreadsheet SDK Documentation
Explore Samples
Sign Up for ByteScout Spreadsheet SDK Online Training
Get Your API Key
Explore Web API Docs
Explore Web API Samples
60 Day Free Trial or Visit ByteScout Spreadsheet SDK Home Page
Explore ByteScout Spreadsheet SDK Documentation
Explore Samples
Sign Up for ByteScout Spreadsheet SDK Online Training
Get Your API Key
Explore Web API Docs
Explore Web API Samples
also available as: