Insertar imagen de fondo en Excel con Node.js usando C++

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

Configurar fondo de hoja con Aspose.Cells for Node.js via C++

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

const fs = require("fs");
const path = require("path");
const AsposeCells = require("aspose.cells.node");

// The path to the documents directory.
const dataDir = path.join(__dirname, "data");
const backgroundImagePath = path.join(dataDir, "background.jpg");

// Create a new Workbook.
const workbook = new AsposeCells.Workbook();

// Get the first worksheet.
const sheet = workbook.getWorksheets().get(0);

// Set the background image for the worksheet.
sheet.setBackgroundImage(fs.readFileSync(backgroundImagePath).buffer);

// Save the Excel file
workbook.save("outputBackImageSheet.xlsx");

// Save the HTML file
workbook.save("outputBackImageSheet.html", AsposeCells.SaveFormat.Html);

Artículos relacionados