SnapText Interface

Provides functionality to manipulate text in Snap documents.

Namespace: DevExpress.Snap.Core.API

Assembly: DevExpress.Snap.v21.2.Core.dll


public interface SnapText :

The following members accept/return SnapText objects:


SnapText class represents SNTEXT fields in a Shap document. Call the ISnapFieldOwner.CreateSnText method to create a new SnapText object. Refer to the Snap Fields topic for a list of available field switches.


The code sample below shows how to insert SNTEXT fields in a table row.

// Add a Snap list to the document.
SnapList list = doc.CreateSnList(doc.Range.End, @"List");
list.EditorRowLimit = 100;

// Add a header to the Snap list.
SnapDocument listHeader = list.ListHeader;
Table listHeaderTable = listHeader.Tables.Create(listHeader.Range.End, 1, 3);
TableCellCollection listHeaderCells = listHeaderTable.FirstRow.Cells;
listHeader.InsertText(listHeaderCells[0].ContentRange.End, "Product Name");
listHeader.InsertText(listHeaderCells[1].ContentRange.End, "Units in Stock");
listHeader.InsertText(listHeaderCells[2].ContentRange.End, "Unit Price");

// Customize the row template.
SnapDocument listRow = list.RowTemplate;
Table listRowTable = listRow.Tables.Create(listRow.Range.End, 1, 3);
TableCellCollection listRowCells = listRowTable.FirstRow.Cells;
listRow.CreateSnText(listRowCells[0].ContentRange.End, @"ProductName");
listRow.CreateSnText(listRowCells[1].ContentRange.End, @"UnitsInStock");
listRow.CreateSnText(listRowCells[2].ContentRange.End, @"UnitPrice \$ $0.00");


Field Result in Case of Empty Data

You can use SnapSingleListItemEntity.EnableEmptyFieldDataAlias property to use an alternative field result (the SnapSingleListItemEntity.EmptyFieldDataAlias value) if the related entry is empty. The table below shows SNTEXT field result in different empty data source scenarios:

Empty Data Source Scenario

Field Result

Empty data source (no data source entries or objects in the list)


The data source does not contain the required entry

Empty line or SnapSingleListItemEntity.EmptyFieldDataAlias value

The required data entry is null or DBNull.Value

Empty line or SnapSingleListItemEntity.EmptyFieldDataAlias value

The required data entry returns an empty string.

Empty string. The SnapSingleListItemEntity.EnableEmptyFieldDataAlias property value is ignored.

See Also