Impostazione della larghezza della colonna o dell'altezza della riga

Impostazione della larghezza della colonna

Per impostare la larghezza di una colonna utilizzando Aspose.Cells.GridDesktop:

  1. Accedi a un foglio di lavoro.
  2. Accedi alla colonna di cui desideri modificare la larghezza.
  3. Imposta la larghezza della colonna.
// 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();
// Adding sample value to sheet cell
GridCell cell = sheet.Cells["a1"];
cell.SetCellValue("Welcome to Aspose!");
// Accessing the first column of the worksheet
Aspose.Cells.GridDesktop.Data.GridColumn column = sheet.Columns[0];
// Setting the width of the column
column.Width = 150;

Impostazione dell’altezza della riga

Per impostare l’altezza di una riga utilizzando Aspose.Cells.GridDesktop, procedi nel seguente modo:

  1. Accedi a qualsiasi foglio di lavoro desiderato.
  2. Accedi alla riga di cui desideri modificare l’altezza.
  3. Imposta l’altezza della riga.
// 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();
// Adding sample value to sheet cells
GridCell cell = sheet.Cells["b2"];
cell.SetCellValue("1");
cell = sheet.Cells["c2"];
cell.SetCellValue("2");
cell = sheet.Cells["d2"];
cell.SetCellValue("3");
cell = sheet.Cells["e2"];
cell.SetCellValue("4");
// Accessing the first row of the worksheet
Aspose.Cells.GridDesktop.Data.GridRow row = sheet.Rows[1];
// Setting the height of the row
row.Height = 100;