Free Support Forum -

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 !


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[0, 0].PutValue("Voor meer informatie\nga naar de Informatiepagina op\nThis is the third line");
cell[0, 0].Style.IsTextWrapped = true;
wb.Save("d:\\test\\autofittingtest.xls", FileFormatType.Excel2003);
For further reference, please check the following topics in the Aspose.Cells documentation:
Thank you.