TX Sheet Control

Range Class

Class
Namespace
TXTextControl.TXSheetControl.Server
Package
TXTextControl.TXSheetControl.Server from the private NuGet feed or the supplied NuGet folder
Assembly
TXTextControl.TXSheetControl.Api.dll
Install
dotnet add package TXTextControl.TXSheetControl.Server .NET 10 and later.
Also in
TXTextControl.TXSheetControl.Blazor as TXTextControl.TXSheetControl.Api.dll
Inherits
  1. DocumentObject
  2. Range
Derived
Cell

A worksheet-bound rectangular range for atomic reads, writes, formatting and copy operations.

Syntax

public class Range

Members

Properties

PropertyDescription
Address
Sheet

Methods

MethodDescription
ClearAsyncPerforms an operation on this document without activating another worksheet.
CopyToAsyncPerforms an operation on this document without activating another worksheet.
FillToAsyncPropagates formulas, formatting or inferred series from this seed into an extended A1 range.
FormatAsyncPerforms an operation on this document without activating another worksheet.
GetBoundsAsyncPerforms an operation on this document without activating another worksheet.
GetColumnCountAsyncPerforms an operation on this document without activating another worksheet.
GetRowCountAsyncPerforms an operation on this document without activating another worksheet.
GetValuesAsyncPerforms an operation on this document without activating another worksheet.
MergeAsyncMerges application data into an isolated document snapshot before replacing the current workbook.
ReadAsyncPerforms an operation on this document without activating another worksheet.
SetFormulasAsyncPerforms an operation on this document without activating another worksheet.
SetInputsAsyncPerforms an operation on this document without activating another worksheet.
SetValidationAsyncInstalls a validation rule on this range; subsequent edits are enforced atomically.
SetValuesAsyncPerforms an operation on this document without activating another worksheet.
UnmergeAsyncPerforms 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);
}

See Also