Resize Rows and Columns

Working with Row Heights and Column Width

Setting Row Height

To set the height of a row:

  1. Add the Aspose.Cells.GridWeb control to your Web Form.
  2. Access the worksheet’s Cells collection.
  3. Set the height of all cells in any specified row.
// 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);

Setting Column Width

To set the width of a column:

  1. Add the Aspose.Cells.GridWeb control to your Web Form.
  2. Access the worksheet’s Cells collection.
  3. Set the width of all cells in any specified column.
// 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);