예제 #1
0
        private void InputSpread_WorkbookLoaded(object sender, WorkbookLoadedEventArgs args)
        {
            string sheetName;

            for (int sheets = 0; sheets < InputSpread.Workbook.Worksheets.Count; sheets++)
            {
                sheetName = InputSpread.Workbook.Worksheets[sheets].Name;
                int adopted = 0;
                for (int col0 = 1; col0 < InputSpread.ActiveSheet.UsedRange.LastColumn + 1; col0++)
                {
                    if (adopted == 0)
                    {
                        for (int v = 0; v < 4; v++)
                        {
                            if (InputSpread.ActiveSheet.Range[2, col0].Value.ToString() == ColArgs[v])
                            {
                                adopted = 1;
                            }
                        }
                    }
                    else
                    {
                        for (int col4 = 1; col4 < InputSpread.ActiveSheet.UsedRange.LastColumn + 1; col4++)
                        {
                            InputSpread.ActiveSheet.Range[2, col4].CellStyle.Color  = colors[Int32.Parse(InputSpread.ActiveSheet.Range[1, col4].Value)];
                            InputSpread.ActiveSheet.Range[2, col4].CellStyle.Locked = true;
                            InputSpread.ActiveGrid.InvalidateCell(2, col4);
                        }
                        break;
                    }
                }
                if (adopted == 0)
                {
                    InputSpread.SetActiveSheet(sheetName);
                    InputSpread.ActiveSheet.InsertRow(1, 2);
                    int lastcol = InputSpread.ActiveSheet.UsedRange.LastColumn + 1;
                    InputSpread.ActiveGrid.FrozenRows = 3;
                    for (int col = 1; col < lastcol; col++)
                    {
                        InputSpread.ActiveSheet.Range[1, col].Value            = "0";
                        InputSpread.ActiveSheet.Range[2, col].Value            = ColArgs[Int32.Parse(InputSpread.ActiveSheet.Range[1, col].Value)];
                        InputSpread.ActiveSheet.Range[2, col].CellStyle.Color  = colors[Int32.Parse(InputSpread.ActiveSheet.Range[1, col].Value)];
                        InputSpread.ActiveSheet.Range[2, col].CellStyle.Locked = true;
                    }
                }
                InputSpread.ActiveSheet.CellValueChanged     += ActiveSheet_CellValueChanged;
                InputSpread.ActiveGrid.Model.ColumnsInserted += Model_ColumnsInserted;
            }
        }
예제 #2
0
        private void InputSpread_WorksheetAdded(object sender, Syncfusion.UI.Xaml.Spreadsheet.Helpers.WorksheetAddedEventArgs args)
        {
            string sheetName = args.SheetName;

            InputSpread.SetActiveSheet(sheetName);
            InputSpread.ActiveSheet.InsertRow(1, 2);
            InputSpread.ActiveGrid.FrozenRows = 3;
            for (int col = 1; col < InputSpread.ActiveGrid.ColumnCount + 1; col++)
            {
                InputSpread.ActiveSheet.Range[1, col].Value            = "0";
                InputSpread.ActiveSheet.Range[2, col].Value            = ColArgs[Int32.Parse(InputSpread.ActiveSheet.Range[1, col].Value)];
                InputSpread.ActiveSheet.Range[2, col].CellStyle.Color  = colors[Int32.Parse(InputSpread.ActiveSheet.Range[1, col].Value)];
                InputSpread.ActiveSheet.Range[2, col].CellStyle.Locked = true;
            }
            InputSpread.ActiveSheet.CellValueChanged     += ActiveSheet_CellValueChanged;
            InputSpread.ActiveGrid.Model.ColumnsInserted += Model_ColumnsInserted;
        }