Node.js ve C++ kullanarak Excel e Arka Plan Resmi Ekleme
Microsoft Excel’de Sayfa Arka Planını Ayarlama
Microsoft Excel’de bir sayfanın arka plan görüntüsünü ayarlamak için (örneğin, Microsoft Excel 2019 için):
-
Sayfa Düzeni menüsünden Sayfa Ayarı seçeneğini bulun ve ardından Arka Plan seçeneğine tıklayın.
-
Tablonun arka plan resmini ayarlamak için bir resim seçin.
Tablo arka planı ayarlama
Aspose.Cells for Node.js via C++ ile Sayfa Arka Planı ayarlama
Aşağıdaki kod, bir akıştaki bir resim kullanarak arka plan resmini ayarlar.
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);