أرسل Shape Front أو Back داخل ورقة العمل
Contents
[
Hide
]
سيناريوهات الاستخدام الممكنة
عندما تكون هناك أشكال متعددة موجودة في نفس الموقع ، فإن كيفية ظهورها يتم تحديدها من خلال مواضع ترتيب z. يوفر Aspose.Cellsالشكل إلى الأمام أو الخلف ()الطريقة التي تغير موضع الترتيب z للشكل. إذا كنت تريد إرسال شكل إلى الخلف ، فستستخدم رقمًا سالبًا مثل -1 ، -2 ، -3 ، وما إلى ذلك ، وإذا كنت تريد إرسال شكل إلى الأمام ، فستستخدم رقمًا موجبًا مثل 1 ، 2 ، 3 ، إلخ.
أرسل Shape Front أو Back داخل ورقة العمل
يشرح نموذج التعليمات البرمجية التالي استخدامالشكل إلى الأمام أو الخلف () طريقة. الرجاء مراجعةنموذج لملف Excel المستخدمة داخل الكود وإخراج ملف Excel ولدت به. تُظهر لقطة الشاشة تأثير الكود على نموذج ملف Excel عند التنفيذ.
عينة من الرموز
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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"); |