Hintergrundbild in Excel einfügen

Blatthintergrund in Microsoft Excel festlegen

Um ein Hintergrundbild für ein Blatt in Microsoft Excel festzulegen (z. B. Microsoft Excel 2019):

  1. Wählen Sie im Menü Seitenlayout die Option Seiteneinrichtung und anschließend die Option Hintergrund.

  2. Wählen Sie ein Bild aus, um das Hintergrundbild des Blatts festzulegen.

    Festlegen eines Blatthintergrunds

todo:image_alt_text

Blatthintergrund mit Aspose.Cells festlegen

Der unten stehende Code legt ein Hintergrundbild mithilfe eines Bildes aus einem Stream fest.

// 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");

Verwandte Artikel