Inoltra la forma davanti o dietro all interno del foglio di lavoro con Node.js tramite C++
Possibili Scenari di Utilizzo
Quando ci sono più forme nello stesso punto, la loro visibilità è determinata dalle posizioni z-order. Aspose.Cells fornisce il metodo Shape.toFrontOrBack(), che cambia la posizione z-order della forma. Per inviare una forma in secondo piano, utilizza un numero negativo come -1, -2, -3, ecc., e per portare una forma in primo piano, utilizza un numero positivo come 1, 2, 3, ecc.
Invia la forma avanti o indietro all’interno del foglio di lavoro
Il seguente esempio spiega l’uso del metodo Shape.toFrontOrBack(). Guarda il file Excel di esempio usato nel codice e il file Excel di output generato. Lo screenshot mostra l’effetto del codice sul file Excel di esempio dopo l’esecuzione.
Codice di Esempio
const path = require("path");
const AsposeCells = require("aspose.cells.node");
// The path to the documents directory.
const dataDir = path.join(__dirname, "data");
const sourceFilePath = path.join(dataDir, "sampleToFrontOrBack.xlsx");
// Load source Excel file
const workbook = new AsposeCells.Workbook(sourceFilePath);
// Access first worksheet
const worksheet = workbook.getWorksheets().get(0);
// Access first and fourth shape
const shape1 = worksheet.getShapes().get(0);
const shape4 = worksheet.getShapes().get(3);
// Print the Z-Order position of the shape
console.log("Z-Order Shape 1: " + shape1.getZOrderPosition());
// Send this shape to front
shape1.toFrontOrBack(2);
// Print the Z-Order position of the shape
console.log("Z-Order Shape 4: " + shape4.getZOrderPosition());
// Send this shape to back
shape4.toFrontOrBack(-2);
// Save the output Excel file
const outputFilePath = path.join(dataDir, "outputToFrontOrBack.xlsx");
workbook.save(outputFilePath);