Çalışma sayfası içindeki Şekil Önüne veya Arkasına Gönderme

Olası Kullanım Senaryoları

Aynı konumda birden fazla şekil bulunduğunda, nasıl görünecekleri z-sıralama pozisyonlarına göre belirlenir. Aspose.Cells for Python via .NET, şeklin z-sıralama pozisyonunu değiştiren Shape.to_front_or_back() metodunu sağlar. Bir şekli arka plana göndermek için negatif sayı like -1, -2, -3 kullanırsınız. Ön plana göndermek için ise pozitif sayı like 1, 2, 3 kullanılır.

Çalışma Sayfası İçinde Şekil Önüne veya Arkasına Gönderme

Aşağıdaki örnek kod, Shape.to_front_or_back() yönteminin kullanımını açıklar. Kod içinde kullanılan örnek Excel dosyası ve kod tarafından oluşturulan çıktı Excel dosyası‘nın etkisini gösteren ekran görüntüsünü göstermektedir.

todo:image_alt_text

Örnek Kod

from aspose.cells import Workbook
# For complete examples and data files, please go to https:# github.com/aspose-cells/Aspose.Cells-for-.NET
# Load source Excel file
wb = Workbook(sourceDir + "sampleToFrontOrBack.xlsx")
# Access first worksheet
ws = wb.worksheets[0]
# Access first and fourth shape
sh1 = ws.shapes[0]
sh4 = ws.shapes[3]
# Print the Z-Order position of the shape
print("Z-Order Shape 1: " + str(sh1.z_order_position))
# Send this shape to front
sh1.to_front_or_back(2)
# Print the Z-Order position of the shape
print("Z-Order Shape 4: " + str(sh4.z_order_position))
# Send this shape to back
sh4.to_front_or_back(-2)
# Save the output Excel file
wb.save(outputDir + "outputToFrontOrBack.xlsx")