قم بإزالة أوراق العمل
Contents
[
Hide
]
يوفر هذا الموضوع معلومات حول كيفية إزالة أوراق العمل من ملفات Excel Microsoft باستخدام Aspose.Cells.GridWeb API ، ومن الممكن إما إزالة ورقة العمل عن طريق تحديد فهرس الورقة الخاص بها أو اسمها.
إزالة ورقة عمل
باستخدام فهرس الورقة
يوضح الكود أدناه كيفية إزالة ورقة عمل عن طريق تحديد فهرس الورقة الخاص بها في طريقة RemoveAt الخاصة بـ GridWorksheetCollection.
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 | |
if (GridWeb1.WorkSheets.Count > 2) | |
{ | |
// Removing a worksheet using its index | |
GridWeb1.WorkSheets.RemoveAt(1); | |
} |
استخدام اسم الورقة
يوضح الكود أدناه كيفية إزالة ورقة عمل عن طريق تحديد اسم الورقة الخاص بها في أسلوب RemoveAt الخاص بـ GridWorksheetCollection.
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 | |
// Removing a worksheet using its name | |
if (GridWeb1.WorkSheets["Teachers"] != null) | |
{ | |
GridWeb1.WorkSheets.RemoveAt("Teachers"); | |
} |
من الممكن أيضًا إزالة ورقة العمل باستخدام مرجعها أو مثيلها. للقيام بذلك ، استخدم أسلوب إزالة GridWorksheetCollection. هذا النهج شائع الاستخدام.