Inserire un immagine di sfondo in Excel

Impostare lo sfondo del foglio in Microsoft Excel

Impostare un’immagine di sfondo di un foglio in Microsoft Excel (ad esempio, Microsoft Excel 2019):

  1. Dal menu Layout di pagina, individuare l’opzione Imposta pagina e fare clic sull’opzione Sfondo.
  2. Seleziona un’immagine da impostare come sfondo del foglio.

Impostare lo sfondo del foglio con Aspose.Cells

Il codice di seguito imposta un’immagine di sfondo utilizzando un’immagine da un flusso.

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()