This is a migrated thread and some comments may be shown as answers.

Radgridview Export Row height issue

1 Answer 176 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Deasun
Top achievements
Rank 3
Bronze
Bronze
Bronze
Deasun asked on 09 Jun 2020, 01:12 PM

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.

 

 

 

 

1 Answer, 1 is accepted

Sort by
0
Nadya | Tech Support Engineer
Telerik team
answered on 10 Jun 2020, 02:47 PM

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.
Tags
GridView
Asked by
Deasun
Top achievements
Rank 3
Bronze
Bronze
Bronze
Answers by
Nadya | Tech Support Engineer
Telerik team
Share this question
or