إدراج الصفوف والأعمدة
Contents
[
Hide
]
يشرح هذا الموضوع كيفية إدراج صفوف وأعمدة جديدة في ورقة عمل باستخدام واجهة برمجة تطبيقات Aspose.Cells.GridWeb. يمكن إدراج الصفوف أو الأعمدة في أي موقع في ورقة العمل.
إدراج الصفوف
لإدراج صف في أي موضع في ورقة العمل:
- أضف عنصر تحكم Aspose.Cells.GridWeb إلى نموذج الويب.
- الوصول إلى ورقة العمل التي تقوم بإضافة الصفوف إليها.
- إدراج صف عن طريق تحديد فهرس الصف الذي سيتم إدراج الصف فيه.
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 | |
// Accessing the reference of the worksheet that is currently active | |
GridWorksheet sheet = GridWeb1.WorkSheets[GridWeb1.ActiveSheetIndex]; | |
// Get row index entered by user | |
int rowIndex = Convert.ToInt16(txtRowIndex.Text.Trim()); | |
// Add row at specified index | |
sheet.Cells.InsertRow(rowIndex); |
إدراج الأعمدة
لإدراج عمود في أي موضع في ورقة العمل:
- أضف تحكم Aspose.Cells.GridWeb إلى استمارة الويب.
- الوصول إلى ورقة العمل التي تقوم بإضافة الأعمدة إليها.
- إدراج عمود عن طريق تحديد فهرس العمود الذي سيتم إدراج العمود فيه.
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 | |
// Accessing the reference of the worksheet that is currently active | |
GridWorksheet sheet = GridWeb1.WorkSheets[GridWeb1.ActiveSheetIndex]; | |
// Get column index entered by user | |
int columnIndex = Convert.ToInt16(txtColumnIndex.Text.Trim()); | |
// Add column at specified index | |
sheet.Cells.InsertColumn(columnIndex); |
يمكنك أيضًا استخدام طرق InsertRows/InsertColumns لإدراج صفوف/أعمدة متعددة في ورق العمل وفقًا لذلك.