# Background Image

Learn how to the set the background image in a worksheet using DsExcel with a sample code.

## Content

DsExcel allows you to set background image in a worksheet using the [BackgroundPicture](/document-solutions/dot-net-excel-api/api/online/DS.Documents.Excel/GrapeCity.Documents.Excel.IWorksheet.BackgroundPicture.html) property of the [IWorksheet](/document-solutions/dot-net-excel-api/api/online/DS.Documents.Excel/GrapeCity.Documents.Excel.IWorksheet.html) interface. The background image can be saved to Excel and is rendered multiple times, side by side, to cover the whole area of the worksheet.

## Using Code

Refer to the following example code to save sheet background image in Excel.

```csharp
// Initialize workbook
Workbook workbook = new Workbook();
// Fetch default worksheet 
IWorksheet worksheet = workbook.Worksheets[0];
worksheet.Range["A1"].Value = "Document Solutions for Excel";
worksheet.Range["A1"].Font.Size = 25;

using (FileStream pictureStream = File.Open(@"image.png", FileMode.Open, FileAccess.Read))

{
    MemoryStream pictureMemoryStream = new MemoryStream();

    pictureStream.CopyTo(pictureMemoryStream);
    byte[] picturebytes = pictureMemoryStream.ToArray();

    //Add background image of the worksheet
    worksheet.BackgroundPicture = picturebytes;

}

workbook.Save(@"SetBackgroundImage.xlsx", SaveFileFormat.Xlsx);
```

![worksheet-background-image](https://cdn.mescius.io/document-site-files/images/9ef1b0ea-3f00-48ea-ad80-9af150dddb0b/worksheet-background-image.d03950.png)

The background image can also be included while exporting the worksheet to PDF documents. For more information, refer to [Support Sheet Background Image](/document-solutions/dot-net-excel-api/docs/online/ManageFileOperations/ExporttoaPDFFile/support_sheet_background_image) in this documentation.