行と列の削除
Contents
[
Hide
]
このトピックでは、Aspose.Cells.GridWeb API を使用してワークシートから行や列を削除する方法について示します。この機能を使うことで、開発者は実行時に行や列を削除できます。
行の削除
ワークシートから行を削除するには:
- Web フォームに 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()); | |
// Delete row at specified index | |
sheet.Cells.DeleteRow(rowIndex); |
列の削除
ワークシートから列を削除するには:
- Web フォームに 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()); | |
// Delete column at specified index | |
sheet.Cells.DeleteColumn(columnIndex); |
DeleteRows/DeleteColumns メソッドを使用してワークシートから複数の行や列を削除することも可能です。