Excel e Arka Plan Görüntüsü Ekleme
Microsoft Excel’de Sayfa Arka Planını Ayarlama
Microsoft Excel’de bir sayfanın arka plan görüntüsünü ayarlamak için (örneğin, Microsoft Excel 2019 için):
-
Sayfa Düzeni menüsünden Sayfa Ayarı seçeneğini bulun ve ardından Arka Plan seçeneğine tıklayın.
-
Tablonun arka plan resmini ayarlamak için bir resim seçin.
Tablo arka planı ayarlama
Aspose.Cells ile Sayfa Arka Planı Ayarlama
Aşağıdaki kod, bir akıştaki bir resim kullanarak arka plan resmini ayarlar.
// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-Java | |
// Create a new Workbook. | |
Workbook workbook = new Workbook(); | |
// Get the first worksheet. | |
Worksheet sheet = workbook.getWorksheets().get(0); | |
// Get the image file. | |
File file = new File("background.jpg"); | |
// Get the picture into the streams. | |
byte[] imageData = new byte[(int) file.length()]; | |
FileInputStream fis = new FileInputStream(file); | |
fis.read(imageData); | |
// Set the background image for the sheet. | |
sheet.setBackgroundImage(imageData); | |
fis.close(); | |
// Save the excel file | |
workbook.save("SBPforWorksheet.xlsx"); |