Method InsertRows
- Namespace
- DocWright.Spreadsheet
- Assembly
- DocWright.Spreadsheet.dll
InsertRows(int, int, XlsxInsertOptions?)
Inserts rows; the rows from at on move down.
public void InsertRows(int at, int count = 1, XlsxInsertOptions? options = null)
Parameters
atintThe one-based row the first new row becomes.
countintHow many rows.
optionsXlsxInsertOptionsWhere the new rows take their format from; null for the row above, as in Excel.
Remarks
Everything that pointed at the rows that move still points at them: formulas on every sheet, defined names, print areas and titles, merged ranges, tables, conditional formats, validations, hyperlinks' cells, filters, sparklines, chart series, comments and the anchors of pictures, shapes and charts. Row heights, hidden rows and outline levels move with their rows; manual breaks and a frozen pane follow. Cells changed before the call move too. The rules are Excel's, measured.
Nothing is calculated: the saved workbook asks for a calculation when it is next opened.
Exceptions
- ArgumentOutOfRangeException
The rows are not inside the grid.
- InvalidOperationException
The sheet is not a worksheet, or the insert would push cells off the end of the sheet.
- UnsupportedFeatureException
The rows would split an array formula.
- ResourceLimitExceededException
The format copied is more cells than MaxFormattedCells.
- InvalidDocumentException
A part of the workbook is malformed.