Insérer une image d arrière plan dans Excel

Configuration de l’arrière-plan de la feuille dans Microsoft Excel

Pour définir une image d’arrière-plan de la feuille dans Microsoft Excel (par exemple, Microsoft Excel 2019) :

  1. Dans le menu Mise en page, recherchez l’option Configuration de la page, puis cliquez sur l’option Arrière-plan.
  2. Sélectionnez une image pour définir l’arrière-plan de la feuille.

Configuration de l’arrière-plan de la feuille avec Aspose.Cells

Le code ci-dessous définit une image d’arrière-plan à l’aide d’une image provenant d’un flux.

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