Free Support Forum - aspose.com

AutoFitRow problems

Good day,

Could you help me with AutoFitRow method? My code makes a sheet's headers rotated to 45%:

for (cellIndex = 0; cellIndex < subjectsList.Count + 5; cellIndex++)

{

sheet.Cells[0, cellIndex].Style.HorizontalAlignment = TextAlignmentType.Center;

sheet.Cells[0, cellIndex].Style.Font.IsBold = true;

sheet.Cells[0, cellIndex].Style.Borders[Aspose.Excel.BorderType.LeftBorder].LineStyle = Aspose.Excel.CellBorderType.Thin;

sheet.Cells[0, cellIndex].Style.Borders[Aspose.Excel.BorderType.RightBorder].LineStyle = Aspose.Excel.CellBorderType.Thin;

sheet.Cells[0, cellIndex].Style.Rotation = 45;

//sheet.Cells[0, cellIndex].Style.IsTextWrapped = true;

}

sheet.AutoFitRow(0);

When I set IsTextWrapped to true, I see wrapped headers and correct fitted row. But when I do not wrap the text, the row is not fitted. How can I fix this?

Thank you,

Sean

Hi Sean,

Actually AutoFitRow method ignores rotation of text. If you don't wrap the text, Aspose.Excel just process cell's data as in a single line. I will consider this feature.

Currently I think you'd better set IsTextWrapped property to true or manually set row height.