列での Cell コントロールの管理
Contents
[
Hide
]
このトピックでは、Aspose.Cells.GridDesktop API を使用して列内のセル コントロールを管理することに関するいくつかの重要な概念について説明します。開発者がワークシートの列からセル コントロールにアクセス、変更、および削除する方法について説明します。それを見てみましょう。
Cell コントロールへのアクセス
開発者は、列内の既存のセル コントロールにアクセスして変更するために、Aspose.Cells.GridDesktop.Data.GridColumn .セル コントロールにアクセスすると、開発者は実行時にそのプロパティを変更できます。たとえば、以下の例では、既存のチェックボックス特定の細胞制御Aspose.Cells.GridDesktop.Data.GridColumnその Checked プロパティを変更しました。
重要: CellControl プロパティは、セル コントロールを次の形式で提供します。セルコントロール物体。したがって、特定の種類のセル コントロールにアクセスする必要がある場合は、チェックボックス次に、型キャストする必要がありますセルコントロール異議を唱えるチェックボックスクラス。
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 worksheet of the Grid that is currently active | |
Worksheet sheet = gridDesktop1.GetActiveWorksheet(); | |
// Accessing cell control in the column and typecasting it to CheckBox | |
Aspose.Cells.GridDesktop.CheckBox cb = (Aspose.Cells.GridDesktop.CheckBox)sheet.Columns[2].CellControl; | |
if (cb != null) | |
{ | |
// Modifying the Checked property of CheckBox | |
cb.Checked = true; | |
} | |
else | |
{ | |
MessageBox.Show("Please add control before accessing it."); | |
} |
Cell コントロールの削除
既存のセル コントロールを削除するには、開発者は目的のワークシートにアクセスしてから、削除するを使用して、特定の列からのセル コントロール削除セル コントロール方法Aspose.Cells.GridDesktop.Data.GridColumn.
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 worksheet of the Grid that is currently active | |
Worksheet sheet = gridDesktop1.GetActiveWorksheet(); | |
// Removing cell control from the column | |
sheet.Columns[2].RemoveCellControl(); |
の各列コラムのコレクションワークシートのインスタンスで表されますAspose.Cells.GridDesktop.Data.GridColumnクラス。