Указанный аргумент находился вне диапазона допустимых значений.
Workbook newBook = new Workbook(); Worksheet newSheet = newBook.Worksheets[0]; Workbook workbook = new Workbook(); workbook.LoadFromFile(filename); Worksheet sheet = workbook.Worksheets[0]; foreach (CellRange range in sheet.Columns[0]) { CellRange sourceRange = sheet.Range[range.Row, 1, range.Row, columnCount]; CellRange destRange = newSheet.Range[i, 1, i, columnCount]; sheet.Copy(sourceRange, destRange, true); i++; }
Что я уже пробовал:
Workbook newBook = new Workbook(); Worksheet newSheet = newBook.Worksheets[0]; Workbook workbook = new Workbook(); workbook.LoadFromFile(filename); Worksheet sheet = workbook.Worksheets[0]; foreach (CellRange range in sheet.Columns[0]) { CellRange sourceRange = sheet.Range[range.Row, 1, range.Row, columnCount];//error CellRange destRange = newSheet.Range[i, 1, i, columnCount]; sheet.Copy(sourceRange, destRange, true); i++; }