We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Can we set the Cell Height and Width using API?

Can we set the Cell Height and Width using API? Please provide sample code.

Yes, you can. Please refer to Cells.SetRowHeight and Cells.SetColumnWidth.

For example, if you want to set the height and width of Cell B2 in Sheet1, you can try the following code.

Cells cells = excel.Worksheets[0].Cells;
cells.SetRowHeigth(1, 15);
cells.SetColumnWidth(1, 12);

Then height of Cell B2 will be 15 and width is 12.

@klakshmi,
Aspose.Cells has replaced Aspose.Excel which is discontinued now and no more active development is done for it. This new product is better in performance and support for the range of features as compared to its predecessor. Using Aspose.Cells we can not only set height and width of particular row and column but we can also set height/width of all the rows and columns. Here is a simple example which can be used to test this feature.

// Instantiating a Workbook object
// Opening the Excel file through the file stream
Workbook workbook = new Workbook(fstream);

// Accessing the first worksheet in the Excel file
Worksheet worksheet = workbook.Worksheets[0];

// Setting the height of the second row to 13
worksheet.Cells.SetRowHeight(1, 13);

// Saving the modified Excel file
workbook.Save(dataDir + "output.out.xls");

// Closing the file stream to free all resources
fstream.Close();

Follow the link below for detailed information about this feature:
Adjusting Row Height and Column Width

Download the free trial version here:
Aspose.Cells for .NET (Latest Version)

Get a runnable solution here for testing a variety of features provided by this new product.