Range 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 - Range
- Document
- Derived
- Cell
A worksheet-bound rectangular range for atomic reads, writes, formatting and copy operations.
Syntax
public class Range
Members
Properties
Methods
| Method | Description |
|---|---|
| ClearAsync | Performs an operation on this document without activating another worksheet. |
| CopyToAsync | Performs an operation on this document without activating another worksheet. |
| FillToAsync | Propagates formulas, formatting or inferred series from this seed into an extended A1 range. |
| FormatAsync | Performs an operation on this document without activating another worksheet. |
| GetBoundsAsync | Performs an operation on this document without activating another worksheet. |
| GetColumnCountAsync | Performs an operation on this document without activating another worksheet. |
| GetRowCountAsync | Performs an operation on this document without activating another worksheet. |
| GetValuesAsync | Performs an operation on this document without activating another worksheet. |
| MergeAsync | Merges application data into an isolated document snapshot before replacing the current workbook. |
| ReadAsync | Performs an operation on this document without activating another worksheet. |
| SetFormulasAsync | Performs an operation on this document without activating another worksheet. |
| SetInputsAsync | Performs an operation on this document without activating another worksheet. |
| SetValidationAsync | Installs a validation rule on this range; subsequent edits are enforced atomically. |
| SetValuesAsync | Performs an operation on this document without activating another worksheet. |
| UnmergeAsync | Performs an operation on this document without activating another worksheet. |
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[]> CreateRangeReportAsync(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 range = sheet.Range("B8:B9");
await range.FormatAsync(new { numberFormatCode = "#,##0.00", fontFamily = "Liberation Sans", fontSize = 11 });
await range.FormatAsync(new { numberFormatCode = "€ #,##0.00", fillColor = "#e5eef4", bold = true });
return await control.SaveAsync(StreamType.PDF);
}