Insertar imagen de fondo en Excel

Establecer fondo de hoja en Microsoft Excel

Para establecer una imagen de fondo de hoja en Microsoft Excel (por ejemplo, Microsoft Excel 2019):

  1. Desde el menú Diseño de página, encontrar la opción Configurar página, y luego hacer clic en la opción Fondo.

  2. Seleccionar una imagen para establecer la imagen de fondo de la hoja.

    Establecer un fondo de hoja

todo:image_alt_text

Establecer fondo de hoja con Aspose.Cells

El código a continuación establece una imagen de fondo utilizando una imagen de un flujo.

// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-Java
// Create a new Workbook.
Workbook workbook = new Workbook();
// Get the first worksheet.
Worksheet sheet = workbook.getWorksheets().get(0);
// Get the image file.
File file = new File("background.jpg");
// Get the picture into the streams.
byte[] imageData = new byte[(int) file.length()];
FileInputStream fis = new FileInputStream(file);
fis.read(imageData);
// Set the background image for the sheet.
sheet.setBackgroundImage(imageData);
fis.close();
// Save the excel file
workbook.save("SBPforWorksheet.xlsx");

Artículos relacionados