Last Updated: 07 Oct 2020 11:46 by ADMIN
Release R3 2020 SP1 (LIB 2020.3.1007)
Created on: 15 Sep 2020 12:33
Category: UI for WinForms
Type: Bug Report
RadGridView: Export to excel does not position images correctly when grid is grouped

To reproduce:
1. Add an image column and set wider columns than the images.
2. Group the grid(note that by default the image alignment is center).
3. Export using GridViewSpreadExport
4. The images in the exported file are not centered in the cells.
Note that the issue is not reproducible when there are not groups in the grid. 

1 comment
Posted on: 15 Sep 2020 12:44
Subscribe to the WorkbookCreated event of SpreadExportRenderer and adjust the position of the image, like the following code:
private void Renderer_WorkbookCreated(object sender, WorkbookCreatedEventArgs e)
    if (this.gridView.GroupDescriptors.Count == 0)

    foreach (var imageShape in e.Workbook.ActiveWorksheet.Shapes)
        double cellWidth = e.Workbook.ActiveWorksheet.Columns[imageShape.CellIndex.ColumnIndex].GetWidth().Value.Value;
        double imageWidth = imageShape.Width;
        imageShape.OffsetX = (cellWidth - imageWidth) / 2;