• XAF ExportController Custom ExportAction Items


     ChoiceActionItem item1 = exportController.ExportAction.Items.FindItemByID("DOCX File"); // 大写第一个单词
    
     ChoiceActionItem item = exportController.ExportAction.Items.Find(ExportTarget.Xls); // 用枚举来查找

    附上完整的ViewController代码:

      public partial class MExportController : ViewController
        {
            public MExportController()
            {
                InitializeComponent();
                // Target required Views (via the TargetXXX properties) and create their Actions.
                TargetViewType = ViewType.ListView;
                TargetObjectType = typeof(ProjectTask);
            }
    
            private ExportController exportController;
    
            protected override void OnActivated()
            {
                base.OnActivated();
                // Perform various tasks depending on the target View.
                exportController = Frame.GetController<ExportController>();
                if (exportController != null)
                {
                    exportController.ExportActionItemsCreated +=
                        new EventHandler<EventArgs>(exportController_ExportActionItemsCreated);
                }
            }
    
            private void exportController_ExportActionItemsCreated(object sender, EventArgs e)
            {
                //  // 把xls导出的格式放到第一个位置上
                //  if (exportController.ExportAction.Items.FirstActiveItem != null)
                //  {
                //      if (((ExportTarget)exportController.ExportAction.Items.FirstActiveItem.Data) !=
                //ExportTarget.Xls)
                //      {
                //          ChoiceActionItem item = exportController.ExportAction.Items.Find(ExportTarget.Xls);
                //          exportController.ExportAction.Items.Remove(item);
                //          exportController.ExportAction.Items.Insert(0, item);
                //      }
                //  }
                
                if (exportController.ExportAction.Items.Count > 0)
                {
                    var dd = exportController.ExportAction.Items.FindItemByID("DOCX File"); // 测试获取,大写第一个单词                
                }
            }
    
            protected override void OnViewControlsCreated()
            {
                base.OnViewControlsCreated();
                // Access and customize the target View control.
            }
    
            protected override void OnDeactivated()
            {
                // Unsubscribe from previously subscribed events and release other references and resources.
                base.OnDeactivated();
    
                if (exportController != null)
                {
                    exportController.ExportActionItemsCreated -=
                       new EventHandler<EventArgs>(exportController_ExportActionItemsCreated);
                }
            }
        }

     参考连接:https://docs.devexpress.com/CoreLibraries/DevExpress.XtraPrinting.ExportTarget

  • 相关阅读:
    thinkPHP中怎么访问域名直接跳到后台登录页面
    使用ajax方法实现form表单的提交
    微信小程序根据生日获取年龄
    微信小程序出现 text 设置行高 line-height 无效的问题
    微信小程序中换行,空格(多个空格)写法
    如何用css实现弧度圆角?三角形以及圆形
    微信小程序的bindtap事件
    JS控制只能输入数字并且最多允许小数点两位
    微信小程序如何做金额输入限制
    微信小程序使用函数的三种方法
  • 原文地址:https://www.cnblogs.com/lishidefengchen/p/15305851.html
Copyright © 2020-2023  润新知