Back to Devexpress

FormControlCollection.AddLabel(CellRange) Method

officefileapi-devexpress-dot-spreadsheet-dot-formcontrolcollection-dot-addlabel-x28-devexpress-dot-spreadsheet-dot-cellrange-x29.md

latest2.3 KB
Original Source

FormControlCollection.AddLabel(CellRange) Method

Creates a label form control at the specified cell range.

Namespace : DevExpress.Spreadsheet

Assembly : DevExpress.Spreadsheet.v25.2.Core.dll

NuGet Package : DevExpress.Spreadsheet.Core

Declaration

csharp
LabelFormControl AddLabel(
    CellRange targetRange
)
vb
Function AddLabel(
    targetRange As CellRange
) As LabelFormControl

Parameters

NameTypeDescription
targetRangeCellRange

The cell range where the form control should be located.

|

Returns

TypeDescription
LabelFormControl

The label form control.

|

Remarks

Example

The code sample below creates a label form control:

csharp
using DevExpress.Spreadsheet;

Workbook workbook = new Workbook();
workbook.LoadDocument("Document.xlsx");

var cellRange = workbook.Worksheets[0].Range["B2:C2"];
var labelFormControl = formControls.AddLabel(cellRange);
labelFormControl.PlainText = "Label";
vb
Imports DevExpress.Spreadsheet

Dim workbook As New Workbook()
workbook.LoadDocument("Document.xlsx")

Dim cellRange = workbook.Worksheets(0).Range("B2:C2")
Dim labelFormControl = formControls.AddLabel(cellRange)
labelFormControl.PlainText = "Label"

Note

The FormControlCollection.AddLabel method call adds a new item to both FormControlCollection and ShapeCollection.

See Also

FormControlCollection Interface

FormControlCollection Members

DevExpress.Spreadsheet Namespace