Çalışma sayfası içindeki Şekil Önüne veya Arkasına Gönderme
Olası Kullanım Senaryoları
Aynı konumda birden fazla şekil bulunduğunda, görünür olmaları şeklin Z-sıra konumlarına göre belirlenir. Aspose.Cells, şeklin Z-sıra konumunu değiştiren Shape.ToFrontOrBack() metodunu sağlar. Şekli arka plana göndermek istiyorsanız, -1, -2, -3 vb. gibi negatif sayılar kullanacak ve şekli öne göndermek istiyorsanız, 1, 2, 3 vb. gibi pozitif sayılar kullanacaksınız.
Çalışma Sayfası İçinde Şekil Önüne veya Arkasına Gönderme
Aşağıdaki örnek kod, Shape.ToFrontOrBack() yönteminin kullanımını açıklar. Lütfen kod içinde kullanılan örnek Excel dosyasını ve bunun tarafından oluşturulan çıktı Excel dosyasını görün. Ekran görüntüsü, kodun örneğine olan etkiyi göstermektedir.
Örnek Kod
// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-Java | |
//Load source Excel file | |
Workbook wb = new Workbook(srcDir + "sampleToFrontOrBack.xlsx"); | |
//Access first worksheet | |
Worksheet ws = wb.getWorksheets().get(0); | |
//Access first and fourth shape | |
Shape sh1 = ws.getShapes().get(0); | |
Shape sh4 = ws.getShapes().get(3); | |
//Print the Z-Order position of the shape | |
System.out.println("Z-Order Shape 1: " + sh1.getZOrderPosition()); | |
//Send this shape to front | |
sh1.toFrontOrBack(2); | |
//Print the Z-Order position of the shape | |
System.out.println("Z-Order Shape 4: " + sh4.getZOrderPosition()); | |
//Send this shape to back | |
sh4.toFrontOrBack(-2); | |
//Save the output Excel file | |
wb.save(outDir + "outputToFrontOrBack.xlsx"); |