예제 #1
0
 public static void ReStoreLayOut(DevExpress.XtraGrid.Views.BandedGrid.AdvBandedGridView ListView)
 {
     if (System.IO.File.Exists(Common.GetSolutionPath(Application.StartupPath) + @"GridLayout\" + Application.ProductName + "." + ListView.GridControl.FindForm ().Name + "." + ListView.GridControl.Name + "." + ListView.Name + ".xml"))
         ListView.RestoreLayoutFromXml(Common.GetSolutionPath(Application.StartupPath) + @"GridLayout\" + Application.ProductName + "." + ListView.GridControl.FindForm ().Name + "." + ListView.GridControl.Name + "." + ListView.Name + ".xml");
 }
예제 #2
0
파일: Utility.cs 프로젝트: sunpander/VSDT
            /// <summary>
            ///  Ѱ��(��className+����Form������+"_"+EFDevLayoutControl������)�������ļ�.���ز���..���ݲ���(����ģʽ)ѡ���ӦĿ¼�µ������ļ�.
            /// </summary>
            /// <param name="ConfigModule">����ģʽ,Ĭ��ʱ�Ȳ����û�����,�ٲ�����Ŀ������..</param>
            /// <param name="className">������[����������_+EFDevLayoutControl���Ʋ�������Ψһxml�ļ�������ʱ,�ڿ�ͷ���������</param>
            /// <param name="moduleName">һ��ģ������.��DE,FI��</param>
            public void LoadLayout(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);
                string fileDirectoryUser = fileDirectory + "\\..\\UserConfig\\" + "EF.EF_Args.formUserId" + "\\" + moduleName + "\\";
                string fileDirectoryEP = fileDirectory + "\\..\\" + moduleName + "\\";

                //�Ȳ鿴�û�������,Ŀ¼�����ڶ�ȡ��Ŀ����
                //  ---2011-10-27 �� XML�������� ��Ϊ "��������_"+EFDevLayoutControl������+_className.XML
                string fileName = formName + "_" + layoutControl.Name + (className.Trim().Equals("") ? "" : ("_" + className.Trim())) + ".xml";
                //string fileName = className.Trim() + formName + "_" + layoutControl.Name + ".xml";
                string filePath = "";
                if (ConfigModule == ConfigEnum.EPConfig)
                {
                    filePath = fileDirectoryEP + fileName;
                }
                else if (ConfigModule == ConfigEnum.UserConfig)
                {
                    filePath = fileDirectoryUser + fileName;
                }
                else //Ĭ������.�ȶ�ȡ�û�������,���������ȡ��Ŀ������
                {
                    filePath = fileDirectoryUser + fileName;
                    if (!  IsFileExit(ref filePath))//������,���ȡ��Ŀ����
                    {
                        filePath = fileDirectoryEP + fileName;
                    }
                }

                if   (IsFileExit(ref filePath))    // (System.IO.File.Exists(filePath))  //����,���ȡ
                {

                    //string EPConfigXML = fileDirectoryEP + fileName; //��Ŀ������xml
                    //��Ŀ������xml ������ھ��鷳��---������,��ֱ�Ӷ�ȡ�����ļ�
                    //---�ȼ�����Ŀ������,�Ѳ��ɼ�����,����Ϊ��������
                    //---������û������� "�ټ����û�������",�����˳�
                    //---�ٰѲ�����������Ϊ���ɼ�
                    //if (System.IO.File.Exists(EPConfigXML))
                    //{
                    //    layoutControl.RestoreLayoutFromXml(EPConfigXML);
                    //    if (view is DevExpress.XtraGrid.Views.Grid.GridView)
                    //    {
                    //        foreach (DevExpress.XtraGrid.Columns.GridColumn gridCol in ((DevExpress.XtraGrid.Views.Grid.GridView)view).Columns)
                    //        {
                    //            gridCol.OptionsColumn.ShowInCustomizationForm = gridCol.Visible;
                    //        }
                    //    }
                    //    //Ȼ������û�������
                    //    if (filePath.Equals(EPConfigXML))
                    //    {
                    //        break;
                    //    }
                    //    view.RestoreLayoutFromXml(filePath);
                    //    //Ȼ���ٴμ��,����Ŀ�����ɼ���,Ҳ��Ϊ���ɼ�
                    //    if (view is DevExpress.XtraGrid.Views.Grid.GridView)
                    //    {
                    //        foreach (DevExpress.XtraGrid.Columns.GridColumn gridCol in ((DevExpress.XtraGrid.Views.Grid.GridView)view).Columns)
                    //        {
                    //            gridCol.Visible = gridCol.OptionsColumn.ShowInCustomizationForm;
                    //        }
                    //    }
                    //}
                    //else
                    //{
                    //    view.RestoreLayoutFromXml(filePath);
                    //}
                    layoutControl.RestoreLayoutFromXml(filePath);
                   // return true;
                }
                else
                {
                   // return false;
                }
            }
예제 #3
0
 public static void ReStoreLayOut(DevExpress.XtraGrid.Views.Grid.GridView ListView, string PageName, string frmName)
 {
     if (System.IO.File.Exists(Common.GetSolutionPath(Application.StartupPath) + @"GridLayout\" 
                             + Application.ProductName + "."
                             + frmName + "."
                             + PageName + "."
                             + ListView.GridControl.Name + "." + ListView.Name + ".xml"))
         ListView.RestoreLayoutFromXml(Common.GetSolutionPath(Application.StartupPath) + @"GridLayout\"
                             + Application.ProductName + "."
                             + frmName + "."
                             + PageName + "."
                             + ListView.GridControl.Name + "." + ListView.Name + ".xml");
 }
예제 #4
0
파일: User.cs 프로젝트: DaoManhTuan/DoAn1
        /// <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");
        }