Renderizza il foglio di lavoro su un contesto grafico con Node.js tramite C++

Contents
[ ]

Il seguente codice illustra come usare Aspose.Cells per rendere un foglio di lavoro in un contesto grafico. Una volta eseguito, stamperà l’intero foglio di lavoro e riempirà lo spazio vuoto residuo con colore blu nel contesto grafico, salvando l’immagine come file **OutputImage_out_.png**. Puoi usare qualsiasi file Excel di origine per provare questo codice. Si consiglia anche di leggere i commenti all’interno del codice per una migliore comprensione.

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

// The path to the documents directory.
const dataDir = path.join(__dirname, "data");
const filePath = path.join(dataDir, "SampleBook.xlsx");
// Create workbook object from source file
const workbook = new AsposeCells.Workbook(filePath);

// Access first worksheet
const worksheet = workbook.getWorksheets().get(0);

// Create empty image buffer
const bmpOptions = new AsposeCells.ImageOrPrintOptions();
bmpOptions.setOnePagePerSheet(true);

// Render worksheet to image
const sheetRender = new AsposeCells.SheetRender(worksheet, bmpOptions);
sheetRender.toImage(0, dataDir + "/OutputImage_out.png");

// Save the image in Png format