- Document Solutions for Excel, .NET Edition Overview
- Key Features
- Getting Started
-
Features
- Worksheet
- Workbook
- Comments
- Hyperlinks
- Sort
- Filter
- Group
- Conditional Formatting
- Data Validations
- Data Binding
- Import Data
- Digital Signatures
- Formulas
- Custom Functions
- Shapes
- Document Properties
- Styles
- Form Controls
- Barcodes
- Themes and Colors
- Chart
- Table
- Pivot Table
- Pivot Chart
- Sparkline
- Slicer
- Logging
- Defined Names
- Templates
- File Operations
- Document Solutions Data Viewer
- API Reference
- Release Notes
(Showing Draft Content)
Background Image
DsExcel allows you to set background image in a worksheet using the BackgroundPicture property of the IWorksheet 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.
// 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
The background image can also be included while exporting the worksheet to PDF documents. For more information, refer to Support Sheet Background Image in this documentation.