Настройка ширины столбца или высоты строки

Настройка ширины столбца

Чтобы установить ширину столбца с помощью Aspose.Cells.GridDesktop:

  1. Доступ к рабочему листу.
  2. Получите доступ к столбцу, ширину которого вы хотите изменить.
  3. Установите ширину столбца.
// 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;

Настройка высоты строки

Чтобы установить высоту строки с помощью Aspose.Cells.GridDesktop, выполните следующие действия:

  1. Получите доступ к любому желаемому рабочему листу.
  2. Получите доступ к строке, высоту которой вы хотите изменить.
  3. Установите высоту строки.
// 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;