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.

Blatthintergrund mit Aspose.Cells festlegen

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

import jpype
import asposecells
jpype.startJVM()
from asposecells.api import Workbook
# Create a new Workbook.
workbook = Workbook()
# Get the first worksheet.
worksheet = workbook.getWorksheets().get(0)
# Get the background picture.
with open('Background.jpg', 'rb') as f:
data = f.read()
# Set the background image for the sheet.
worksheet.setBackgroundImage(data)
# Save the excel file
workbook.save("output.xlsx")
jpype.shutdownJVM()