Every ByteScout tool includes simple example C# source codes that you can get here or in the folder with installed ByteScout product. What is ByteScout Barcode Suite? It is the bundle that privides 3 SDK products to generate barcodes (Barcode SDK), read barcodes (Barcode Reaer SDK) and read and write spreadsheets (Spreadsheet SDK). It can help you to add header and footer for spreadsheet with spreadsheet sdk in your C# application.
These C# code samples for C# guide developers to speed up coding of the application when using ByteScout Barcode Suite. Follow the instructions from scratch to work and copy the C# code. Further improvement of the code will make it more robust.
Our website gives trial version of ByteScout Barcode Suite for free. It also includes documentation and source code samples.
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 Barcode Suite Home Page
Explore ByteScout Barcode Suite Documentation
Explore Samples
Sign Up for ByteScout Barcode Suite Online Training
Get Your API Key
Explore Web API Docs
Explore Web API Samples
60 Day Free Trial or Visit ByteScout Barcode Suite Home Page
Explore ByteScout Barcode Suite Documentation
Explore Samples
Sign Up for ByteScout Barcode Suite Online Training
Get Your API Key
Explore Web API Docs
Explore Web API Samples
also available as: