Search code examples
c#asp.netasp.net-mvcdevexpress-mvc

How to change DevExpress MVC Grid header text on export to vertical (from bottom to top)


I'm using DevExpress v14.1 to export the grid content as an image.

The whole functionality is working, I even got the header to show in vertical mode

settings.SettingsExport.RenderBrick += (s, e) => {
            if (e.RowType == GridViewRowType.Header)
            {
                e.BrickStyle.StringFormat = new DevExpress.XtraPrinting.BrickStringFormat( StringFormatFlags.DirectionVertical | StringFormatFlags.NoClip | StringFormatFlags.NoWrap);
                return;
            }
            else if (e.RowType != GridViewRowType.Data)
            {
                return;
            }

But I got the text starting at the top of the header and going to the bottom, and I want it the other way, going from the bottom to the top of the header.

As in this example


Solution

  • That's the DevExpress forum answer.

    Hello, As far as I understand you need to turn headers 180 degrees. I researched this scenario and found that RenderBrick does not provide the capability to do this. You can use our XtraReports suite that provides wide capabilities for export and allows the grid export. See the Create a Table Report documentation article. Let me know if you need any further assistance.

    As for your second question, the cell size is calculated earlier than RenderBrick is raised based on cell content. RenderBrick allows customizing the exported text style but without changing cell size. So, your workaround is appropriate in this case.

    That's the forum link