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.