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

  • 469350
    Offline posted

    Hi Karen,

    I don't beleive that there is any support in the Infragistics Excel engine for AutoSizing rows at this time.

    I recommend that you Submit a feature request to Infragistics.

    What the grid exporting does is autosize the grid row and then use that same size for the Excel row. So I suppose you could use the height of the grid row as a basis for estimating the height you need for your comment row, although it won't be 100% of course.