Table of Contents

Method Delete

Namespace
DocWright.Spreadsheet
Assembly
DocWright.Spreadsheet.dll

Delete()

Deletes the sheet from the workbook.

public void Delete()

Remarks

What Excel does, measured: every reference to the sheet becomes #REF! - in formulas, defined names, chart series, conditional formats and validations - and a reference through several sheets that started or ended on it starts or ends on the next sheet inwards. The names that belong to the sheet (its print area and titles among them) go with it, and so does every part only this sheet reaches: its drawing and charts, its tables, its comments, its pivot tables, its printer settings. A pivot cache that a pivot table on another sheet still uses stays.

A workbook has to show at least one sheet, so the last visible one cannot be deleted. The sheet the workbook opens on stays the same sheet; when that is the sheet deleted, it is the one that takes its place.

Nothing is calculated: the saved workbook asks for a full calculation, as it does after a cell is changed. The object is of no use afterwards.

Exceptions

InvalidOperationException

The sheet is the workbook's only visible one, or was deleted already.

InvalidDocumentException

A part of the workbook is malformed.