Free Support Forum - aspose.com

How to set Cell Height as per the Text inside

Hi !!

Appreciate, if you guide me to set Cell Height for the text inside.

Thanx a lot !

Hi,

Please use Worksheet.AutoFitRow(s) and Worksheet.AutoFitColumn(s) for your need.

I write a simple example for you:

Workbook wb = new Workbook();
Worksheet ws = wb.Worksheets["Sheet1"];
Cells cell = ws.Cells;
cell.SetColumnWidth(0, 35);
cell.SetRowHeight(0,36);
cell[0, 0].PutValue("Voor meer informatie\nga naar de Informatiepagina op\nThis is the third line");
cell[0, 0].Style.IsTextWrapped = true;
ws.AutoFitRow(0);
wb.Save("d:\\test\\autofittingtest.xls", FileFormatType.Excel2003);
For further reference, please check the following topics in the Aspose.Cells documentation:
http://www.aspose.com/documentation/file-format-components/aspose.cells-for-.net-and-java/autofit-rows-columns.html
http://www.aspose.com/documentation/file-format-components/aspose.cells-for-.net-and-java/adjusting-row-height-column-width.html
Thank you.