Inserire un immagine di sfondo in Excel
Contents
[
Hide
]
Puoi rendere un foglio di lavoro più accattivante aggiungendo un’immagine come sfondo del foglio. Questa funzionalità può essere molto efficace se hai una grafica aziendale speciale che aggiunge un tocco di sfondo senza oscurare i dati nel foglio. Puoi impostare l’immagine di sfondo per un foglio utilizzando l’API Aspose.Cells.
Impostare lo sfondo del foglio in Microsoft Excel
Impostare un’immagine di sfondo di un foglio in Microsoft Excel (ad esempio, Microsoft Excel 2019):
- Dal menu Layout di pagina, individuare l’opzione Imposta pagina e fare clic sull’opzione Sfondo.
- 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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() |