Вставка строк и столбцов

Вставка строк

Чтобы вставить строку в любое место на листе:

  1. Добавьте элемент управления Aspose.Cells.GridWeb в веб-форму.
  2. Получите доступ к рабочему листу, на который вы добавляете строки.
  3. Вставьте строку, указав индекс строки, куда будет вставлена строка.
// 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);

Вставка столбцов

Чтобы вставить столбец в любое место на листе:

  1. Добавьте элемент управления Aspose.Cells.GridWeb в веб-форму.
  2. Получите доступ к рабочему листу, на который вы добавляете столбцы.
  3. Вставьте столбец, указав индекс столбца, в который будет вставлен столбец.
// 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);