Insertar imagen de fondo en Excel
Contents
[
Hide
]
Puede hacer que una hoja de cálculo sea más atractiva agregando una imagen como fondo de la hoja. Esta función puede ser muy efectiva si tiene un gráfico corporativo especial que agrega un toque del fondo sin ocultar los datos en la hoja. Puede establecer una imagen de fondo para una hoja utilizando la API de Aspose.Cells.
Establecer fondo de hoja en Microsoft Excel
Para establecer una imagen de fondo de hoja en Microsoft Excel (por ejemplo, Microsoft Excel 2019):
- Desde el menú Diseño de página, encontrar la opción Configurar página, y luego hacer clic en la opción Fondo.
- Seleccionar una imagen para establecer la imagen de fondo de la hoja.
Establecer fondo de hoja con Aspose.Cells
El código a continuación establece una imagen de fondo utilizando una imagen de un flujo.
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() |