//create a new workbook var workbook = new GrapeCity.Documents.Excel.Workbook(); var fileStream = this.GetResourceStream("xlsx\\To_Do_List.xlsx"); workbook.Open(fileStream); IWorksheet worksheet = workbook.Worksheets[0]; Stream stream = this.GetResourceStream("AcmeLogo.png"); //Add a background picture for the worksheet, and the background picture will be rendered into the destination rectangle[10, 10, 500, 370]. IBackgroundPicture picture = worksheet.BackgroundPictures.AddPictureInPixel(stream, ImageType.PNG, 10, 10, 500, 370); //The background picture will be resized to fill the destination dimensions. picture.BackgroundImageLayout = ImageLayout.Tile; //Sets the transparency of the background picture. picture.Transparency = 0.50; // Save to a pdf file workbook.Save("SaveBackgroundPicturesToPDF.pdf");
' Create a new Workbook Dim workbook As New Workbook 'Open an excel file Dim fileStream = GetResourceStream("xlsx\\To_Do_List.xlsx") workbook.Open(fileStream) Dim worksheet = workbook.Worksheets(0) Dim stream = GetResourceStream("AcmeLogo.png") Dim imageBytes(CInt(stream.Length) - 1) As Byte stream.Read(imageBytes, 0, imageBytes.Length) 'Add a background picture for the worksheet, and the background picture will be rendered into the destination rectangle[10, 10, 500, 370]. Dim picture As IBackgroundPicture = worksheet.BackgroundPictures.AddPictureInPixel(stream, ImageType.PNG, 10, 10, 150, 100) 'The background picture will be resized to fill the destination dimensions. picture.BackgroundImageLayout = ImageLayout.Tile 'Sets the transparency of the background pictures. picture.Transparency = 0.5 ' save to a pdf file workbook.Save("SaveBackgroundPicturesToPDF.pdf")