Table of Contents

Method Add

Namespace
DocWright.Spreadsheet
Assembly
DocWright.Spreadsheet.dll

Add(XlsxFormControlKind, string, XlsxFormControlOptions?)

Adds a form control at a cell, as Excel's Developer › Insert adds one: its properties part, its entry in the sheet's control list, its shape in the drawing and in the legacy drawing (the four places Excel keeps one), with Excel's defaults for its kind.

public XlsxFormControl Add(XlsxFormControlKind kind, string cell, XlsxFormControlOptions? options = null)

Parameters

kind XlsxFormControlKind

The control's kind (not Other).

cell string

Where its top-left corner goes, as B3.

options XlsxFormControlOptions

Its name, linked cell, list range, caption and size.

Returns

XlsxFormControl

The control.

Exceptions

ArgumentNullException

cell is null.

ArgumentException

The kind is Other; the cell is not a reference; a size is not positive; the name is taken.

InvalidOperationException

The sheet is not a worksheet, or its drawings hold more objects than one legacy drawing block (1,023).