Ticket Q442497
Visible to All Users
Duplicate

We have closed this ticket because another page addresses its subject:

ASPxGridViewExporter don't translate enums

Export to Excel (and other) doesn’t use DisplayNameAttibute for enums.

created 12 years ago

Hello.
See ExportEnum.png
How to fix this?

Answers

created 12 years ago (modified 12 years ago)

Hello Alexey,
Thank you for contacting us. You can implement a solution described in the duplicate ticket: ASPxGridViewExporter don't translate enums.
---------------
Check if Search Engine is able to answer questions faster than I do!
---------------

    Comments (2)

      I solve problem in my case with controller:
          public class FixExportViewController : ViewController<ListView>
          {
              protected override void OnViewControlsCreated()
              {
                  base.OnViewControlsCreated();

      var editor = View.Editor as ASPxGridListEditor;
                  if (editor == null)
                      return;
                  var exporter = editor.Printable as ASPxGridViewExporter;
                  if (exporter == null)
                      return;
                  exporter.RenderBrick += exporter_RenderBrick;
              }
              void exporter_RenderBrick(object sender, ASPxGridViewExportRenderingEventArgs e)
              {
                  if(e.Value is Enum)
                  {
                      e.Text = new EnumDescriptor(e.Value.GetType()).GetCaption(e.Value);
                  }
              }
          }
      Most users expect to see in export what they see in the listview.
      This is especially true for non-english speaking users (DislayName different from enum name).
      Is it possible to use DislayName for enum by default in export?

      Dennis Garavsky (DevExpress) 12 years ago

        Thank you for the feedback, Alexey. I am glad to hear that you have solved this problem as suggested.
        As for your last question, we already have a similar feature request in our TODO list and we will take your feedback into account.

        Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

        Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.