//create a new workbook var workbook = new GrapeCity.Documents.Excel.Workbook(); //Use sheet index to get worksheet. IWorksheet worksheet = workbook.Worksheets[0]; Stream stream = this.GetResourceStream("logo.png"); byte[] imageBytes = new byte[stream.Length]; stream.Read(imageBytes, 0, imageBytes.Length); //Set a background image for worksheet worksheet.BackgroundPicture = imageBytes; // Save to an excel file workbook.Save("SetBackgroundImage.xlsx");
' Create a new Workbook Dim workbook As New Workbook Dim worksheet As IWorksheet = workbook.Worksheets(0) Dim stream As Stream = GetResourceStream("logo.png") Dim imageBytes As Byte() = New Byte(CInt(stream.Length) - 1) {} stream.Read(imageBytes, 0, imageBytes.Length) worksheet.BackgroundPicture = imageBytes ' save to an excel file workbook.Save("SetBackgroundImage.xlsx")