GridDesktopでのセルの結合と解除
Contents
[
Hide
]
このトピックでは、ワークシートのセルを結合および解除する便利な機能について説明します。この機能は、データの可読性を向上させるために一部の行または列を広げる必要がある場合に役立ちます。
セルの結合
次の手順に従ってセルを1つの大きなセルに結合します:
- 任意の Worksheet にアクセスします
- 結合されるセル範囲を作成します
- セル範囲を1つの大きなセルに結合します
ワークシートのMergeメソッドを使用してセルを結合できます。ただし、CellRangeオブジェクトを使用してセル範囲を定義できます。
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(); | |
// Creating a CellRange object starting from "B4" to "C6" | |
CellRange range = new CellRange("B4", "C6"); | |
// Merging a range of cells | |
sheet.Merge(range); |
セルの解除
次の手順に従って大きなセルを複数のセルに解除します:
- 任意の Worksheet にアクセスします
- 解除する必要がある結合されたセルにアクセスします
- 結合されたセルの位置を使用して、大きなセルを複数のセルに解除します
ワークシートのUnmergeメソッドを使用して、セルの位置を使用してセルを解除できます。
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 the merged cell that is currently in focus | |
GridCell cell = sheet.GetFocusedCell(); | |
// Unmerging a cell using its location | |
sheet.Unmerge(cell.Location); |
セルを1つのセルに結合すると、セルの希望の範囲の左上のセルの書式設定が結合されたセルに適用されますが、セルが解除されると、すべての解除されたセルはその書式設定を保持します。