Link Search Menu Expand Document

Add Background Image - C#

Spreadsheet SDK sample in C# demonstrating ‘Add Background Image’

Program.cs
using System.Diagnostics;
using System.Drawing;
using Bytescout.Spreadsheet;

namespace AddBackgroundImage
{
	class Program
	{
		static void Main(string[] args)
		{
			// Create new spreadsheet (or open existing)
			Spreadsheet doc = new Spreadsheet();
			doc.RegistrationName = "demo";
            doc.RegistrationKey = "demo";

			// Add worksheet
			Worksheet worksheet = doc.Worksheets.Add();

			// Put background image on the worksheet
			worksheet.BackgroundPicture = Image.FromFile("image1.jpg");
            
			// Save document
			doc.SaveAs("output.xls");

			// Close spreadsheet
			doc.Close();

			// Open generated XLS document in default application
			Process.Start("output.xls");

			doc.Dispose();
		}
	}
}

Download Source Code (.zip)

Return to the previous page Explore Spreadsheet SDK


Copyright © 2016 - 2021 ByteScout