Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
900
Excel Export - Autosize Rows?
posted

Hi,

Is it possible to autosize a row using the Excel Exporter?  I am using the BeginExport event handler to write a large comment in the top of my report.  I wrap the text and merge some columns for that row, and I'd like to autosize the row so that the entire contents show.  I see where I can set the row's height, but it would be nicer if I could just autosize it since the comment won't necessarily be the same size.

Here is my code from ExcelExporter.BeginExport:

        e.CurrentWorksheet.Rows(2).Cells(0).Value = "This would be a multiline value..."
        e.CurrentWorksheet.MergedCellsRegions.Add(2, 0, 2, 6)
        e.CurrentWorksheet.Rows(2).Cells(0).CellFormat.WrapText = Infragistics.Excel.ExcelDefaultableBoolean.True
        e.CurrentWorksheet.Rows(2).Height = 4800 'Is there a better way to size this row???

Thanks,

~Karen