Radgridview Export Row height issue

2 posts, 0 answers
  1. Deasun
    Deasun avatar
    32 posts
    Member since:
    May 2019

    Posted 09 Jun Link to this post

    I am trying to export a grid with different row heights.

    I have AutoSizeRows = true.

    On the apps screen the grid looks great. :)

    But when I export it I get an error:

    rowHeight should be greater or equal than 0 and less or equal than 600.

     spreadExporter.CellFormatting += spreadExporter_CellFormatting;

    I have a spreadExporter_CellFormatting function and had:

    if (e.GridCellInfo.RowInfo.Height > 600)
                {
                    e.GridCellInfo.RowInfo.Height = 600;
                };

    But it didnt stop the error happening.

    Question, how do I check for the Row height value and set it before/during the export?

     

    Thanks

    Deasun.

     

     

     

     

  2. Nadya
    Admin
    Nadya avatar
    344 posts

    Posted 10 Jun Link to this post

    Hello Deasun,

    Thank you for reporting this.

    After testing the described scenario I was able to receive the same exception when there is a row with RowHeight > 600. This is why I have logged it in our Feedback portal by creating a public thread on your behalf. You can track its progress, subscribe for status changes, and add your comments on the following link: feedback item.

    I have updated your Telerik Points.

    To workaround the issue you can create a custom SpreadExportRenderer and override its SetWorksheetRowHeight method:

    class MySpreadExportRenderer : SpreadExportRenderer
    {
        public override void SetWorksheetRowHeight(int rowIndex, int rowHeight, bool isCustom)
        {
            if (rowHeight > SpreadsheetDefaultValues.MaxRowHeight)
            {
                rowHeight = (int)SpreadsheetDefaultValues.MaxRowHeight;
            }
            base.SetWorksheetRowHeight(rowIndex, rowHeight, isCustom);
        }
    }
    

    I hope this helps. Do not hesitate to contact me if you have other questions.

    Regards,
    Nadya
    Progress Telerik

    Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
    Our thoughts here at Progress are with those affected by the outbreak.
Back to Top