Invia la forma avanti o indietro all interno del foglio di lavoro

Possibili Scenari di Utilizzo

Quando ci sono più forme presenti nello stesso punto, la loro visibilità è decisa dalle loro posizioni nell’ordine z. Aspose.Cells fornisce il metodo Shape.ToFrontOrBack() che cambia la posizione nell’ordine z della forma. Se vuoi inviare la forma in background, userai un numero negativo come -1, -2, -3, ecc. e se vuoi inviare la forma in primo piano, userai un numero positivo come 1, 2, 3, ecc.

Invia la forma avanti o indietro all’interno del foglio di lavoro

Il seguente codice di esempio spiega l’uso del metodo Shape.ToFrontOrBack(). Si prega di consultare il file Excel di esempio utilizzato nel codice e il file Excel di output generato da esso. La schermata mostra l’effetto del codice sul file Excel di esempio in esecuzione.

todo:image_alt_text

Codice di Esempio

// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-.NET
//Load source Excel file
Workbook wb = new Workbook(sourceDir + "sampleToFrontOrBack.xlsx");
//Access first worksheet
Worksheet ws = wb.Worksheets[0];
//Access first and fourth shape
Shape sh1 = ws.Shapes[0];
Shape sh4 = ws.Shapes[3];
//Print the Z-Order position of the shape
Console.WriteLine("Z-Order Shape 1: " + sh1.ZOrderPosition);
//Send this shape to front
sh1.ToFrontOrBack(2);
//Print the Z-Order position of the shape
Console.WriteLine("Z-Order Shape 4: " + sh4.ZOrderPosition);
//Send this shape to back
sh4.ToFrontOrBack(-2);
//Save the output Excel file
wb.Save(outputDir + "outputToFrontOrBack.xlsx");