//create a new workbook var workbook = new GrapeCity.Documents.Excel.Workbook(); IWorksheet worksheet = workbook.Worksheets[0]; Stream stream = this.GetResourceStream("AcmeLogo.png"); //Add background picture IBackgroundPicture picture = worksheet.BackgroundPictures.AddPictureInPixel(stream, ImageType.PNG, 10, 10, 500, 370); //Set image layout picture.BackgroundImageLayout = ImageLayout.Zoom; //Set options workbook.ActiveSheet.PageSetup.PrintGridlines = true; // Save to a pdf file workbook.Save("BackgroundImage.pdf");
' Create a new Workbook Dim workbook As New Workbook Dim worksheet As IWorksheet = workbook.Worksheets(0) Dim stream As Stream = GetResourceStream("AcmeLogo.png") 'Add background picture Dim picture As IBackgroundPicture = worksheet.BackgroundPictures. AddPictureInPixel(stream, ImageType.PNG, 10, 10, 500, 370) 'Set image layout picture.BackgroundImageLayout = ImageLayout.Zoom 'Set options workbook.ActiveSheet.PageSetup.PrintGridlines = True ' save to a pdf file workbook.Save("BackgroundImage.pdf")