# Set Cell Background Image for Cell Range

DsExcel is a Document Solutions product that offers a comprehensive library to create, manipulate, convert, and share Microsoft Excel-compatible spreadsheets.

## Content

DsExcel enables you to set the cell background image and its layout for the cell range using [BackgroundImage](/document-solutions/dot-net-excel-api/api/online/DS.Documents.Excel/GrapeCity.Documents.Excel.IRange.BackgroundImage.html) and [BackgroundImageLayout](/document-solutions/dot-net-excel-api/api/online/DS.Documents.Excel/GrapeCity.Documents.Excel.IRange.BackgroundImageLayout.html) properties in [IRange](/document-solutions/dot-net-excel-api/api/online/DS.Documents.Excel/GrapeCity.Documents.Excel.IRange.html) interface. You can only export the cell background image to PDF, HTML, and IMG and can only view it in SpreadJS when saved in .sjs format. [BackgroundImageLayout](/document-solutions/dot-net-excel-api/api/online/DS.Documents.Excel/GrapeCity.Documents.Excel.BackgroundImageLayout.html) enumeration allows you to set the background image layout to Stretch (default), Center, Zoom, or None.
DsExcel only supports and exports the following image formats as the cell background image:

* PNG
* JPEG/JPG
* ICO
* SVG
* GIF

Refer to the following example code to add a cell background image in different layouts and export the workbook to a PDF file:

```csharp
// Create a new workbook.
var workbook = new Workbook();

IWorksheet worksheet = workbook.Worksheets[0];

// Load the image.
byte[] imageBytes = File.ReadAllBytes("Chrome_icon.png");

worksheet.Range["A2:E2"].Value = new string[] { "Stretch", "Center", "Zoom", "None", "Default(Stretch)" };
worksheet.Range["A3:E3"].Value = "Chrome";
worksheet.Range["A3:E3"].RowHeightInPixel = 80;
worksheet.Range["A3:E3"].ColumnWidthInPixel = 100;

// Add cell background image.
worksheet.Range["A3:E3"].BackgroundImage = imageBytes;

// Set image layout.
worksheet.Range["A3"].BackgroundImageLayout = BackgroundImageLayout.Stretch;
worksheet.Range["B3"].BackgroundImageLayout = BackgroundImageLayout.Center;
worksheet.Range["C3"].BackgroundImageLayout = BackgroundImageLayout.Zoom;
worksheet.Range["D3"].BackgroundImageLayout = BackgroundImageLayout.None;

// Set PDF export options.
workbook.ActiveSheet.PageSetup.PrintGridlines = true;
workbook.ActiveSheet.PageSetup.PrintHeadings = true;

// Save to a PDF file.
workbook.Save("CellBackgroundImage.pdf");
```

![](https://cdn.mescius.io/document-site-files/images/e333ad47-35da-43f9-a389-25433765f491/images/set-background-image.png)
**Limitations**
DsExcel does not support saving the background image to Excel; hence, you cannot view it in Excel.