Validation Class
- Namespace
TXTextControl.TXSheetControl. Server
- Package
TXTextControl.from the private NuGet feed or the supplied NuGet folderTXSheetControl. Server
- Assembly
TXTextControl.TXSheetControl. Api. dll
- Install
dotnet add package TXTextControl..NET 10 and later.TXSheetControl. Server
- Also in
TXTextControl.asTXSheetControl. Blazor TXTextControl.TXSheetControl. Api. dll
- Inherits
- Document
Object - Validation
- Document
Worksheet data validation, including source lists, constraints, messages and atomic edit enforcement.
Syntax
public class Validation
Members
Methods
| Method | Description |
|---|---|
| CheckAsync | Checks the current cell value without changing it or displaying a user interface. |
| ChoicesAsync | Reads list choices, including named and range-based validation sources. |
| ListAsync | Returns detached validation definitions without mutating current values. |
| RemoveAsync | Removes a rule by identity, or all worksheet rules when omitted. |
| SetAsync | Sets a rule for an A1 range; subsequent editor and server edits are validated. |
Examples
Build a small report using this document API and return its PDF bytes. Pass a live control with a fresh workbook; the caller owns its lifetime.
using TXTextControl.TXSheetControl.Server;
async Task<byte[]> CreateValidationReportAsync(ServerSheetControl control)
{
var book = control.Workbook;
var sheet = await book.Sheets.AtAsync(0);
await sheet.Cell("B8").SetValueAsync(120);
await sheet.Cell("B9").SetValueAsync(80);
await sheet.Cell("B10").SetFormulaAsync("=SUM(B8:B9)");
var validation = sheet.Validation;
await validation.SetAsync("B8:B9", new ValidationRule { Type = "decimal", Operator = "between", Formula1 = "0", Formula2 = "10000" });
return await control.SaveAsync(StreamType.PDF);
}