Example #1
0
        //internal DocmentEditorPane EditorPane { get; set; }
        internal void InitUI(ExcelCodeConfig excelCodeConfig)
        {
            this.ExcelCodeConfig = excelCodeConfig;
            this.tabControl1.TabPages.Clear();

            if (excelCodeConfig != null)
            {
                ExcelConfig = ExcelConfig.LoadConfig(excelCodeConfig.AbsoluteFileName);
                if (ExcelConfig != null)
                {
                    excelCodeConfig.ExcelConfig = this.ExcelConfig;
                    foreach (var sheetConfig in ExcelConfig.SheetConfigData.Values)
                    {
                        UISheet uiSheet = new UISheet();
                        //uiSheet.EditorPane = EditorPane;
                        uiSheet.Dock = DockStyle.Fill;
                        uiSheet.SetSheetConfig(sheetConfig, excelCodeConfig);

                        TabPage tabPage = new TabPage(sheetConfig.Name);
                        tabPage.Tag = uiSheet;
                        tabPage.Controls.Add(uiSheet);
                        tabControl1.TabPages.Add(tabPage);
                    }
                }
            }
        }
Example #2
0
        internal void SetSheetConfig(SheetConfig sheetConfig, ExcelCodeConfig excelCodeConfig)
        {
            this.excelCodeConfig = excelCodeConfig;
            this.sheetConfig = sheetConfig;
            this.dataGridView1.Rows.Clear();
            if (sheetConfig != null)
            {
                textBox_ClassName.NameInUndoDescription = string.Format(Properties.Resources.TextBox_ClassNam_NameInUndoDescription, ExcelConfigName, SheetName);
                textBox_ClassName.Text = sheetConfig.ClassName;
                textBox_ClassName.EnableUndo = true;

                dataGridView1.NameInUndoDescription = string.Format(Properties.Resources.DataGridView_NameInUndoDescription, ExcelConfigName, SheetName);
                foreach (var columnConfig in sheetConfig.ColumnConfigData)
                {
                    if (columnConfig.Export)
                    {
                        int rowIndex = dataGridView1.Rows.Add(columnConfig.FieldName, columnConfig.CodeName);
                        dataGridView1.Rows[rowIndex].Tag = columnConfig;
                    }
                }
                dataGridView1.EnableUndo = true;
            }
        }
Example #3
0
        private bool ChangeRootPath(string rootAbsolutePath, bool isForce = false)
        {
            if (!isForce && this.rootPath == rootAbsolutePath)
                return false;

            this.textBox_RootPath.Text = rootAbsolutePath;
            this.rootPath = rootAbsolutePath;
            this.listBox1.Items.Clear();
            this.GetDocmentEditorPane()?.ClearUndoManager();

            try
            {
                List<UIExcel> uiExcelList = new List<UIExcel>();
                foreach (var fileName in Directory.EnumerateFiles(rootAbsolutePath, "*.gzg", SearchOption.AllDirectories))
                {
                    try
                    {
                        string relativePathToRoot = Utility.GetRelativePath(rootAbsolutePath.AppendBackslashIfNotEndWith(), fileName);
                        var excelCodeConfig = new ExcelCodeConfig() { FileName = relativePathToRoot };
                        excelCodeConfig.AbsoluteFileName = fileName;
                        excelCodeConfig.UIExcel = new UIExcel();
                        excelCodeConfig.UIExcel.Dock = DockStyle.Fill;
                        //excelCodeConfig.UIExcel.EditorPane = this.editorPane;
                        excelCodeConfig.UIExcel.InitUI(excelCodeConfig);
                        excelCodeConfig.UIExcel.Tag = listBox1.Items.Add(excelCodeConfig);

                        uiExcelList.Add(excelCodeConfig.UIExcel);
                    }
                    catch { }
                }
                if (listBox1.Items.Count > 0)
                    listBox1.SelectedIndex = 0;

                UIExcel.CreateFindTagLinkList(uiExcelList, listBox1);

                fw.Path = rootAbsolutePath;
                fw.IncludeSubdirectories = true;
                fw.EnableRaisingEvents = true;
            }
            catch { }

            return true;
        }