Exemple #1
0
        public ЭкраннаяФорма ИмпортироватьЭкраннуюФорму(string Файл)
        {
            ЭкраннаяФорма форма = new ЭкраннаяФорма();

            this.sheetFamilyID = GridFormulaEngine.CreateSheetFamilyID();
            ExcelEngine  engine   = new ExcelEngine();
            IApplication excel    = engine.Excel;
            IWorkbook    workbook = engine.Excel.Workbooks.Open(Файл);

            foreach (IWorksheet worksheet in workbook.Worksheets)
            {
                if (worksheet.Name.Trim().ToLower() == "code")
                {
                    continue;
                }
                if (worksheet.Name.Trim().ToLower() == "шапка")
                {
                    ШапкаЭкраннойФормы формы = new ШапкаЭкраннойФормы();
                    GridFormulaEngine.RegisterGridAsSheet("sys_шапка", формы.Представление, this.sheetFamilyID);
                    base.ExcelToGrid(worksheet, формы.Представление);
                    формы.УстановитьСтилевыеНастройкиТаблицы();
                    this.ОбработатьЯчейкиТаблицы(формы);
                    форма.Шапка = формы;
                }
                else
                {
                    this.ПолучитьТаблицыФормы(worksheet, форма);
                }
            }
            return(форма);
        }
Exemple #2
0
        private void Form1_Load(object sender, System.EventArgs e)
        {
            //helper class to mark headers/row on a the calculation sheet
            GridMarkHeadersHelper helper = new GridMarkHeadersHelper(this.gridCalculations);

            helper.RegisterGridForContextMenu(this.gridDisplay);

            this.helperList = new Hashtable();
            this.helperList.Add(this.gridCalculations, helper);

            //register grids for multisheeted use
            int sheetFamilyID = GridFormulaEngine.CreateSheetFamilyID();

            GridFormulaEngine.RegisterGridAsSheet("Display", this.gridDisplay.Model, sheetFamilyID);
            GridFormulaEngine.RegisterGridAsSheet("Calc", this.gridCalculations.Model, sheetFamilyID);

            SetUpDisplaySheet();

            SetUpCalcSheet();

            SetUpNamedRanges();

            //setup copying formulas
            GridFormulaEngine engine = ((GridFormulaCellModel)this.gridCalculations.CellModels["FormulaCell"]).Engine;

            engine.FormulaCopyFlags |= GridFormulaCopyFlags.ClipBoardFormula;

            //make sure calc grid has current cell
            this.tabBarPage2.ActiveControl = this.gridCalculations;
            this.gridCalculations.CurrentCell.MoveTo(1, 1);

            //bring up form on grid in first tab
            this.tabBarSplitterControl1.ActivePage = this.tabBarPage1;
            this.tabBarPage1.ActiveControl         = this.gridDisplay;
            this.gridDisplay.CurrentCell.MoveTo(5, 5);
            this.gridDisplay.Refresh();
            //subscribe to TabBar events to handle splitters generating new grids
            this.tabBarSplitterControl1.PaneCreated += new Syncfusion.Windows.Forms.SplitterPaneEventHandler(tabBar_PaneCreated);
            this.tabBarSplitterControl1.PaneClosing += new Syncfusion.Windows.Forms.SplitterPaneEventHandler(tabBar_PaneClosing);

            this.gridCalculations.Properties.GridLineColor = System.Drawing.Color.Silver;
            this.gridCalculations.DefaultGridBorderStyle   = GridBorderStyle.Solid;
            this.gridCalculations.ThemesEnabled            = true;
            this.Text = "Retirement Simulation Demo";
            this.gridCalculations.GridVisualStyles         = Syncfusion.Windows.Forms.GridVisualStyles.Metro;
            this.gridDisplay.GridVisualStyles              = Syncfusion.Windows.Forms.GridVisualStyles.Metro;
            this.gridDisplay.DefaultRowHeight              = (int)DpiAware.LogicalToDeviceUnits(25.0f);
            this.gridCalculations.DefaultColWidth          = (int)DpiAware.LogicalToDeviceUnits(70.0f);
            this.gridCalculations.DefaultGridBorderStyle   = GridBorderStyle.Solid;
            this.gridCalculations.ThemesEnabled            = true;
            this.gridCalculations.MarkColHeader            = true;
            this.gridCalculations.MarkRowHeader            = true;
            this.gridCalculations.AlphaBlendSelectionColor = Color.Orange;
            this.gridCalculations.Properties.GridLineColor = Color.FromArgb(208, 215, 229);

            this.gridDisplay.GridVisualStyles = Syncfusion.Windows.Forms.GridVisualStyles.Metro;
            this.StartPosition = FormStartPosition.CenterScreen;
            this.tabBarSplitterControl1.ThemesEnabled = true;
            this.gridDisplay.PrepareViewStyleInfo    += new GridPrepareViewStyleInfoEventHandler(gridDisplay_PrepareViewStyleInfo);

            this.tabBarSplitterControl1.ActivePageChanged    += new ControlEventHandler(tabBarSplitterControl1_ActivePageChanged);
            this.tabBarSplitterControl1.ShowVerticalScrollBar = false;
        }