Example #1
0
        public static void SaveLayout(DevExpress.XtraGrid.Views.Grid.GridView ListView, string PageName, string frmName)
        {
            try
            {
                DevExpress.Utils.OptionsLayoutGrid opt = new DevExpress.Utils.OptionsLayoutGrid();
                opt.StoreAllOptions = false;
                opt.Columns.StoreAllOptions = true;
                opt.Columns.StoreLayout = true;
                opt.Columns.StoreAppearance = true;
                opt.StoreVisualOptions = true;
                opt.StoreDataSettings = false;
                ListView.OptionsLayout.Assign(opt);
                ListView.SaveLayoutToXml(Common.GetSolutionPath(Application.StartupPath) + @"GridLayout\" 
                    + Application.ProductName + "."
                    + frmName + "."
                    + PageName + "."
                    + ListView.GridControl.Name + "." + ListView.Name + ".xml");

            }
            catch (Exception ex)
            {
                //TODO::sysParameter.MessageInf
                XtraMsgBox.Show(ex.Message, "", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }

        }
Example #2
0
 /******************************8
 /// <summary>
 /// �Դ���Form������+"_"+EFDevLayoutControl������,�Լ�Ĭ������ģʽ[�ݶ��û���]����grid����
 /// </summary>
 public void SaveLayout(DevExpress.XtraLayout.LayoutControl layoutControl)
 {
     SaveLayout(layoutControl, ConfigEnum.Default);
 }
 /// <summary>
 /// �Դ���Form������+"_"+gridView������,�Լ��ƶ�������ģʽ����grid����
 /// </summary>
 /// <param name="ConfigModule">�û�������Ŀ��</param>
 public void SaveLayout(DevExpress.XtraLayout.LayoutControl layoutControl, ConfigEnum ConfigModule)
 {
     this.SaveLayout(layoutControl, ConfigModule, string.Empty, string.Empty);
 }
 ******************************/
 /// <summary>
 ///  �ļ�Ŀ¼�������򴴽�,XML��������Ϊ: className +"��������_"+EFDevLayoutControl������.XML. 
 ///  ---2011-10-27 �� XML�������� ��Ϊ "��������_"+EFDevLayoutControl������+_className.XML
 /// </summary>  
 /// <param name="ConfigModule">����Ĭ��,�û�������Ŀ��</param>
 /// <param name="className">����,�����������û���ʱ,Ϊ�����ֲ�ͬ������������ </param>   
 /// <param name="moduleName">һ��ģ������(��DE,Ϊ��ʱȡ�������Ƶĵ�4��6λ)</param>
 public void SaveLayout(DevExpress.XtraLayout.LayoutControl layoutControl, ConfigEnum ConfigModule, string className, string moduleName)
 {
     //ģ������
     string formName = layoutControl.FindForm().Name;
     if (moduleName.Trim().Equals(""))
     {
         moduleName = formName.Length > 6 ? formName.Substring(4, 2) : formName;
     }
     if (formName.StartsWith("Form"))
     {
         formName = formName.Substring(4);
     }
     //XML·��
     string fileDirectory = System.Reflection.Assembly.GetExecutingAssembly().Location;
     fileDirectory = Path.GetDirectoryName(fileDirectory);
     if (ConfigModule == ConfigEnum.UserConfig)
     {
         //λ��UserConfig��,�û����ļ�����,һ��ģ����
         fileDirectory = fileDirectory + "\\..\\UserConfig\\" + "EF.EF_Args.formUserId" + "\\" + moduleName + "\\";
     }
     else if (ConfigModule == ConfigEnum.EPConfig)
     {
         //λ��һ��ģ����
         fileDirectory = fileDirectory + "\\..\\" + moduleName + "\\";
     }
     else
     {
         //λ��UserConfig��,�û����ļ�����,һ��ģ���� (Ĭ���û�����)
         fileDirectory = fileDirectory + "\\..\\UserConfig\\" + "EF.EF_Args.formUserId" + "\\" + moduleName + "\\";
     }
     string fileDirectory2 = "";
     try
     {
         fileDirectory2 = fileDirectory + "EC.UserConfig.Instance.Culture" + "\\";
     }
     catch { }
     //�ļ�Ŀ¼�������򴴽�[�߼���,������Ŀ����ʱ,ģ��Ŀ¼һ������,���򱨴�]
     if (!System.IO.Directory.Exists(fileDirectory))
     {
         System.IO.Directory.CreateDirectory(fileDirectory);
     }
     if (fileDirectory2 != "" && !System.IO.Directory.Exists(fileDirectory2))
     {
         System.IO.Directory.CreateDirectory(fileDirectory2);
     }
     //�����ļ���
     //string fileName = className.Trim() + formName + "_" + layoutControl.Name + ".xml";
     //  ---2011-10-27 �� XML�������� ��Ϊ "��������_"+EFDevLayoutControl������+_className.XML
     string fileName = formName + "_" + layoutControl.Name +(className.Trim().Equals("")?"":("_"+className.Trim()))+ ".xml";
     string filePath = fileDirectory + fileName;
     string filePath2 = fileDirectory2 + fileName;
     bool isFirstConfig = false;
     if (System.IO.File.Exists(filePath))
     {
         if (System.IO.File.Exists(filePath2))
         {
             //�ļ��Ѵ���,����ʾ,�Ƿ񸲸�
             if (EF.EFMessageBox.Show("�����ļ��Ѵ���,�Ƿ��滻��","��ʾ", MessageBoxButtons.YesNo) != DialogResult.Yes)
             {
                 return;
             }
         }
     }
     else
     {
         isFirstConfig = false;
     }
     if (isFirstConfig)
     {
         //��ʹ�ǵ�һ������Ҳ�����浽Ĭ��Ŀ¼��.ֻ�ŵ���Ӧ����Ŀ¼��
        // layoutControl.SaveLayoutToXml(filePath);
     }
     layoutControl.SaveLayoutToXml(filePath2);
 }
Example #3
0
        /// <summary>
        /// hàm này cho phép xuất excel và lưu dữ liệu trong Release
        /// </summary>
        /// <param name="v_grv"> tên của gridview</param>
        /// <param name="name"> tên file mà bạn muốn xuất ra</param>
        public static void xuat_excel(DevExpress.XtraGrid.Views.Grid.GridView v_grv, string name)
        {
            name =name+ ".xls";
            v_grv.SaveLayoutToXml("tempLayout.xml");
            foreach (DevExpress.XtraGrid.Columns.GridColumn col in v_grv.Columns)
            {
                col.Visible = true;
            }
            v_grv.ExportToXls(name);

            v_grv.RestoreLayoutFromXml("tempLayout.xml");
        }