Word wrap auto increase row size to accomodate txt


I'm having a difficult time finding the magic code to have the row auto size to fit the text when printing.

In the image clip below, note that the row below the "2PM HARVEY HARVE" will not auto resize when the text is wrapped, making the cell unreadable.  Having the whole row resize to accomodate this single column text is acceptable (how to do it).   My preference isn't calculate the height of each text and manually set the height, unless there's an API call within the component set that I'm not aware of.


This is the basic code I'm using. the "t" is part of a tuple I'm using to pass in properties and other dynamic data that I'm using to build a cell within the context of the cell.  The sched is an object that is having it's content placed into the spreadsheet.  

Let me know if you need additional information regarding the code.

  var propValue = t.Item2;
//Setup cell format/color here
var fmt = xls.GetCellVisibleFormatDef(celly, cellx);
fmt.Borders.Left.Style = TFlxBorderStyle.Thin;
fmt.Borders.Left.Color = TExcelColor.Automatic;
fmt.Borders.Right.Style = TFlxBorderStyle.Thin;
fmt.Borders.Right.Color = TExcelColor.Automatic;
fmt.Borders.Top.Style = TFlxBorderStyle.Thin;
fmt.Borders.Top.Color = TExcelColor.Automatic;
fmt.Borders.Bottom.Style = TFlxBorderStyle.Thin;
fmt.Borders.Bottom.Color = TExcelColor.Automatic;
                               
fmt.FillPattern.Pattern = TFlxPatternStyle.Solid;
byte[] bytes = BitConverter.GetBytes(PropertyHelper.GetIntValue(sched, t.Item3));
fmt.FillPattern.BgColor = TUIColor.FromArgb(bytes[1], bytes[2], bytes[3]);
fmt.FillPattern.FgColor = fmt.FillPattern.BgColor;
fmt.HAlignment = t.Item4.HAlignment;
fmt.VAlignment = TVFlxAlignment.center;
fmt.Font.Style = TFlxFontStyles.Bold;
fmt.WrapText = t.Item4.WordWrap;
if (t.Item4.WordWrap)
  fmt.Format = "@";
fmt.ShrinkToFit = true;
xls.SetCellFormat(celly, cellx, xls.AddFormat(fmt));
xls.SetCellValue(celly, cellx, PropertyHelper.GetValueAsString(sched, propValue));
I noticed my image didn't make it up to the post (it was showing in the post when I was typing it).  Basically the row that has the issue is getting word wrapped, but the row height is not automatically changing to accommodate the text, thus clipping the top and bottom of the text off for cells that have content with word wrapped text.

Hi,

Have you tried http://www.tmssoftware.biz/flexcel/doc/vcl/api/FlexCel.Core/TExcelFile/AutofitRowsOnWorkbook.html or http://www.tmssoftware.biz/flexcel/doc/vcl/api/FlexCel.Core/TExcelFile/AutofitRow.html

Make sure to also read http://www.tmssoftware.biz/flexcel/doc/vcl/guides/api-developer-guide.html#autofitting-rows-and-columns
and also http://www.tmssoftware.biz/flexcel/doc/vcl/tips/fine-tuning-row-autofitting.html?q=autofit

Found a fix.  

I added this call when creating the workbook:
 _xls.AutofitRowsOnWorkbook(true, false, 1);

and when adding rows this call:
if (t.Item4.WordWrap)
{
  xls.AutofitRow(celly, true, 1);
}
WordWrap is a bool, true if the content needs to be word wrapped (text).  celly, is the row.

Thanks for the help.  I was looking entirely in the wrong location for the row related methods.   I thought they would be within the "TflxFormat" class.