行と列の挿入

行の挿入

ワークシートの任意の位置に行を挿入するには:

  1. Aspose.Cells.GridWebコントロールをWebフォームに追加します。
  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. Web フォームに 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);