예제 #1
0
파일: vExcel.cs 프로젝트: GitNothing/vExcel
        public vWorksheet CopySheetByName(string current, string newName)
        {
            var sheetOriginal = _vWorksheets.Find(e => e.TabLabel == current);

            if (sheetOriginal == null)
            {
                throw new Exception($"Cannot copy, {current} was not found.");
            }
            sheetOriginal.GetWorksheet().Copy((Worksheet)ThisApplication.Worksheets[1]);
            var newSheet = (Worksheet)ThisApplication.Worksheets[1];
            var sheet    = new vWorksheet(newSheet, newName);

            _vWorksheets.Add(sheet);
            return(sheet);
        }
예제 #2
0
파일: vExcel.cs 프로젝트: GitNothing/vExcel
        public vWorksheet PushNewSheet(string Name)
        {
            CheckUniqueName(Name);
            ThisApplication.Worksheets.Add(Type.Missing);
            if (!_deletedFirstSheet)
            {
                _deletedFirstSheet = true;
                var excelSheet1 = (Worksheet)ThisApplication.Worksheets[1];
                excelSheet1.Delete();
            }
            var excelSheet = (Worksheet)ThisApplication.Worksheets[1];
            var sheet      = new vWorksheet(excelSheet, Name);

            _vWorksheets.Add(sheet);
            return(sheet);
        }