Beispiel #1
0
        /// <summary>
        /// Open existing worksheet or add one and populate it if the sheet does not exist
        /// </summary>
        public void OpenWorksheet(string sheetName)
        {
            if (content.Worksheets[sheetName] == null)
            {
                content.Worksheets.Add(sheetName);
                SpreadsheetTemplates.SpreadsheetPresetType type = helper.GetSheetType(sheetName);
                switch (type)
                {
                case SpreadsheetTemplates.SpreadsheetPresetType.AREA: {
                    InitAreaSheet(sheetName);
                    currentSheet = content.Worksheets[sheetName];
                    helper.AutoAdjustColumns(currentGroupsByName.Values);
                    return;
                }

                case SpreadsheetTemplates.SpreadsheetPresetType.ENEMY: {
                    InitMobSheet(sheetName);
                    currentSheet = content.Worksheets[sheetName];
                    helper.AutoAdjustColumns(currentGroupsByName.Values);
                    return;
                }
                }
            }
            if (!sheetToAdresses.ContainsKey(sheetName))
            {
                Dicts dicts = SpreadsheetHelper.LoadSpreadsheet(content, sheetName, helper.GetSheetType(sheetName));
                sheetToAdresses.Add(sheetName, dicts.addresses);
                sheetToGroups.Add(sheetName, dicts.groups);
            }
            currentSheet = content.Worksheets[sheetName];
        }
Beispiel #2
0
        /// <summary>
        /// Initializes spreadsheet control with given file
        /// </summary>
        public SpreadsheetInteraction(FileInfo path)
        {
            xlsxFile      = new ExcelPackage(path);
            content       = xlsxFile.Workbook;
            _currentSheet = content.Worksheets["Metin2 Drop Analyzer"];

            helper = new SpreadsheetHelper(this);

            templates = new SpreadsheetTemplates(this);
            templates.InitializeMainSheet();
            sheetToAdresses = new Dictionary <string, Dictionary <string, ExcelCellAddress> >();
            sheetToGroups   = new Dictionary <string, Dictionary <string, Group> >();
        }