CellTypes 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
Registers SVG cell renderers shared with the independent PDF painter.
Syntax
public class CellTypes
Members
Methods
| Method | Description |
|---|---|
| RegisterRendererAsync | Registers a named renderer returning portable SVG. Callbacks must not reenter the control. |
| RemoveRendererAsync | Removes the renderer and releases its host callback. |
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[]> CreateCellTypesReportAsync(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 cellTypes = book.CellTypes;
await cellTypes.RegisterRendererAsync("approval", _ => """<svg xmlns="http://www.w3.org/2000/svg" width="80" height="20"><text x="2" y="15">Approved</text></svg>""");
await sheet.Cell("C8").SetCellTypeAsync(new CellTypeDefinition { Type = "custom", Renderer = "approval" });
return await control.SaveAsync(StreamType.PDF);
}