Skip to main content

insert_cells

Function insert_cells 

Source
pub fn insert_cells(
    book: &mut Spreadsheet,
    sheet: usize,
    area: Range,
    axis: Axis,
) -> Result<()>
Expand description

Inserts blank cells over area, pushing what was there down or right.

This is Excel’s “Insert Cells”, the edit that moves part of a row rather than the whole of it: Axis::Rows pushes the cells below area down by its height, Axis::Columns pushes the cells to its right along by its width. Only the columns (or rows) the area spans move; the rest of the sheet stays where it is, which is exactly why the reference rules differ from insert_rows - a reference is carried only when the whole of it travels.

§Errors

Error::SheetIndexOutOfRange if there is no such sheet, and Error::WouldPushOffSheet if cells that hold something, or a merged area, would be pushed past the edge of the sheet; the book is left as it was.