WorkbookBatch 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
Collects operations locally, then sends one atomic request. Reads occur before creating a batch.
Syntax
public class WorkbookBatch
Members
Methods
| Method | Description |
|---|---|
| Add | Creates or updates a document-bound handle or queued operation; the owning workbook retains validation authority. |
| Clear | Creates or updates a document-bound handle or queued operation; the owning workbook retains validation authority. |
| ConfigurePrint | Creates or updates a document-bound handle or queued operation; the owning workbook retains validation authority. |
| Format | Creates or updates a document-bound handle or queued operation; the owning workbook retains validation authority. |
| FormatText | Creates or updates a document-bound handle or queued operation; the owning workbook retains validation authority. |
| SetFormula | Creates or updates a document-bound handle or queued operation; the owning workbook retains validation authority. |
| SetInput | Creates or updates a document-bound handle or queued operation; the owning workbook retains validation authority. |
| SetRichText | Creates or updates a document-bound handle or queued operation; the owning workbook retains validation authority. |
| SetText | Creates or updates a document-bound handle or queued operation; the owning workbook retains validation authority. |
| SetValue | Creates or updates a document-bound handle or queued operation; the owning workbook retains validation authority. |
| SetValues | Creates or updates a document-bound handle or queued operation; the owning workbook retains validation authority. |
| Update | Creates 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);
}