إزالة أوراق العمل
Contents
[
Hide
]
يقدم هذا الموضوع معلومات حول كيفية إزالة أوراق العمل من ملفات Microsoft Excel باستخدام واجهة برمجة التطبيقات Aspose.Cells.GridWeb. من الممكن إما إزالة ورقة العمل عن طريق تحديد فهرسها أو اسمها.
إزالة ورقة العمل
استخدام فهرس الورقة
يوضح الكود أدناه كيفية إزالة ورقة العمل عن طريق تحديد فهرسها في طريقة 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. يتم استخدام هذا النهج بشكل شائع.