Table of Contents

Method AddListFrom

Namespace
DocWright.Spreadsheet
Assembly
DocWright.Spreadsheet.dll

AddListFrom(XlsxCellRange, string)

Adds a list rule whose items are the values of a range or a name, with the in-cell dropdown.

public XlsxDataValidation AddListFrom(XlsxCellRange range, string source)

Parameters

range XlsxCellRange

The cells the rule covers.

source string

The range or the name, as a formula, with or without its =: $Z$1:$Z$3, Lists!$A$1:$A$3, Choices. A source on another sheet is stored where Excel stores it, in the sheet's extension.

Returns

XlsxDataValidation

The rule.

Exceptions

ArgumentNullException

source is null.

ArgumentException

The source is not a formula, or names a sheet the workbook does not have.

InvalidOperationException

The sheet is not a worksheet.

InvalidDocumentException

A part of the workbook is malformed.