行と列を削除する
Contents
[
Hide
]
このトピックでは、Aspose.Cells.GridWeb API を使用してワークシートから行と列を削除する方法を示します。この機能を利用して、開発者は実行時に行または列を削除できます。
行の削除
ワークシートから行を削除するには:
- Aspose.Cells.GridWeb コントロールを Web フォームに追加します。
- 行を削除するワークシートにアクセスします。
- 行インデックスを指定して、ワークシートから行を削除します。
This file contains hidden or 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()); | |
// Delete row at specified index | |
sheet.Cells.DeleteRow(rowIndex); |
列の削除
ワークシートから列を削除するには:
- Aspose.Cells.GridWeb コントロールを Web フォームに追加します。
- 列を削除するワークシートにアクセスします。
- 列インデックスを指定して、ワークシートから列を削除します。
This file contains hidden or 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()); | |
// Delete column at specified index | |
sheet.Cells.DeleteColumn(columnIndex); |
DeleteRows/DeleteColumns メソッドを使用して、複数の行/列をワークシートから削除することもできます。