TX Sheet Control

WorkbookBatch 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

Collects operations locally, then sends one atomic request. Reads occur before creating a batch.

Syntax

public class WorkbookBatch

Members

Methods

MethodDescription
AddCreates or updates a document-bound handle or queued operation; the owning workbook retains validation authority.
ClearCreates or updates a document-bound handle or queued operation; the owning workbook retains validation authority.
ConfigurePrintCreates or updates a document-bound handle or queued operation; the owning workbook retains validation authority.
FormatCreates or updates a document-bound handle or queued operation; the owning workbook retains validation authority.
FormatTextCreates or updates a document-bound handle or queued operation; the owning workbook retains validation authority.
SetFormulaCreates or updates a document-bound handle or queued operation; the owning workbook retains validation authority.
SetInputCreates or updates a document-bound handle or queued operation; the owning workbook retains validation authority.
SetRichTextCreates or updates a document-bound handle or queued operation; the owning workbook retains validation authority.
SetTextCreates or updates a document-bound handle or queued operation; the owning workbook retains validation authority.
SetValueCreates or updates a document-bound handle or queued operation; the owning workbook retains validation authority.
SetValuesCreates or updates a document-bound handle or queued operation; the owning workbook retains validation authority.
UpdateCreates or updates a document-bound handle or queued operation; the owning workbook retains validation authority.

Examples

Create a working document workflow using WorkbookBatch. Return the generated document or application data to the caller.

using TXTextControl.TXSheetControl.Server;

async Task<byte[]> BuildWorkbookBatchExampleAsync(ServerSheetControl control)
{
    var book = control.Workbook;
    var sheet = await book.Sheets.AtAsync(0);
    var title = sheet.Cell("A1");
    await book.BatchAsync(batch =>
    {
        batch.SetText(title, "October invoice");
        batch.Format(title, new { fontFamily = "Liberation Sans", fontSize = 16, bold = true, textColor = "#ffffff", fillColor = "#163b63" });
        batch.SetValues(sheet.Range("B8:B9"), [[120], [80]]);
        batch.SetFormula(sheet.Cell("B10"), "=SUM(B8:B9)");
        batch.Format(sheet.Range("B8:B10"), new { numberFormatCode = "#,##0.00", fontFamily = "Liberation Sans", fontSize = 11 });
    });

    return await control.SaveAsync(StreamType.PDF);
}

See Also