Ändra storlek på rader och kolumner

Arbeta med radhöjder och kolumnbredder

Ange radhöjd

För att ställa in höjden på en rad:

  1. Lägg till Aspose.Cells.GridWeb-kontrollen i ditt webbformulär.
  2. Få åtkomst till Cells-samlingen i kalkylarket.
  3. Ställ in höjden på alla celler i valfri angiven rad.
// 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);

Ange kolumnbredd

För att ställa in bredden på en kolumn:

  1. Lägg till Aspose.Cells.GridWeb-kontrollen i ditt webbformulär.
  2. Få åtkomst till Cells-samlingen i kalkylarket.
  3. Ställ in bredden på alla celler i valfri angiven kolumn.
// 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);