行と列のサイズ変更
Contents
[
Hide
]
セルの値が、セルの幅よりも広い場合や、複数の行にある場合があります。このような値は、行と列の高さと幅を変更しない限り、ユーザーに完全には表示されません。 Aspose.Cells.GridWeb は、行の高さと列の幅の設定を完全にサポートしています。このトピックでは、例を使用してこれらの機能について詳しく説明します。
行の高さと列の幅の操作
行の高さの設定
行の高さを設定するには:
- Aspose.Cells.GridWeb コントロールを Web フォームに追加します。
- ワークシートの Cells コレクションにアクセスします。
- 指定した行のすべてのセルの高さを設定します。
Cells コレクションの SetRowHeight メソッドと SetColumnWidth メソッドには、行の高さと列の幅の測定値をインチとピクセルで設定するバリアントもあります。
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 | |
// Get row index entered by user | |
int rowIndex = Convert.ToInt16(txtRowIndex.Text.Trim()); | |
// Get row height entered by user | |
int rowHeight = Convert.ToInt16(txtRowHeight.Text.Trim()); | |
// Accessing the cells collection of the worksheet that is currently active | |
GridCells cells = GridWeb1.WorkSheets[GridWeb1.ActiveSheetIndex].Cells; | |
// Resize row at specified index to specified height | |
cells.SetRowHeight(rowIndex, rowHeight); |
列幅の設定
列の幅を設定するには:
- Aspose.Cells.GridWeb コントロールを Web フォームに追加します。
- ワークシートの Cells コレクションにアクセスします。
- 指定された列のすべてのセルの幅を設定します。
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 | |
// Get column index entered by user | |
int columnIndex = Convert.ToInt16(txtColumnIndex.Text.Trim()); | |
// Get column width entered by user | |
int columnWidth = Convert.ToInt16(txtColumnWidth.Text.Trim()); | |
// Accessing the cells collection of the worksheet that is currently active | |
GridCells cells = GridWeb1.WorkSheets[GridWeb1.ActiveSheetIndex].Cells; | |
// Resize column at specified index to specified width | |
cells.SetColumnWidth(columnIndex, columnWidth); |