Back to Devexpress

Cell.Tag Property

officefileapi-devexpress-dot-spreadsheet-dot-cell-61d931ec.md

latest2.3 KB
Original Source

Cell.Tag Property

Gets or sets custom data associated with the cell.

Namespace : DevExpress.Spreadsheet

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

NuGet Package : DevExpress.Spreadsheet.Core

Declaration

csharp
object Tag { get; set; }
vb
Property Tag As Object

Property Value

TypeDescription
Object

An object that contains information associated with the cell.

|

Remarks

The Tag property is used to attach a temporary object to a worksheet cell. You can assign any type derived from the Object class to this property. The property value is cached depending on the cell reference, and the cache is automatically recalculated if the cell is moved, copied, or removed.

Consider the following restrictions when you use the Tag property:

  • Tag objects are not saved to a file and cannot be restored when you reload a document. If you need to save custom data in the document, use custom XML parts or custom document properties.

  • The Tag property values are not stored in the document history. Thus, the Tag objects are not restored by the Undo/Redo operations.

  • The CellRange.CopyFrom method clears cell tags in the target range when all content (PasteSpecial.All) or cell formatting is copied (PasteSpecial.Formats). To avoid this, you can store tag values in a variable (for example, a List), and then restore them after the CopyFrom method execution.

See Also

Cell Interface

Cell Members

DevExpress.Spreadsheet Namespace