行と列のリサイズ
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); |