ServerSheetControl.SetUserNameAsync Method
- Namespace
TXTextControl.TXSheetControl. Server
- Package
TXTextControl.asTXSheetControl. Server TXTextControl.from the private NuGet feed or the supplied NuGet folderTXSheetControl. Server. dll
Sets the current comment author; a simple userName string is sufficient.
Syntax
public Task SetUserNameAsync(string userName, CancellationToken cancellationToken = default)
Parameters
| Parameter | Type | Optional | Description |
|---|---|---|---|
userName | string | No | Value matching userName's declared type and the owning object's validation rules. |
cancellationToken | CancellationToken | Yes | Cancels waiting or execution as supported by this operation. |
Return Value
Task.
Examples
Create and format a complete invoice before using this processing API. Return document bytes, operation metadata or notifications to the application; dispose owned controls after processing.
using TXTextControl.TXSheetControl.Server;
async Task<string> CreateInvoiceSetUserNameAsyncAsync(ServerSheetControl control)
{
var book = control.Workbook;
var sheet = await book.Sheets.AtAsync(0);
await sheet.Range("A7:D9").SetValuesAsync(new object?[][]
{
[],
[],
[]
});
var table = await sheet.Tables.AddAsync("InvoiceLines", "A7:D9", new TableOptions { Style = "TableStyleMedium2", ShowRowStripes = true });
await sheet.Cell("A1").SetTextAsync("October invoice");
await sheet.Cell("A1").FormatAsync(new { fontFamily = "Liberation Sans", fontSize = 16, bold = true, textColor = "#ffffff", fillColor = "#163b63" });
await sheet.Range("C8:D9").FormatAsync(new { numberFormatCode = "#,##0.00", fontFamily = "Liberation Sans", fontSize = 11 });
await control.SetUserNameAsync("Alex Morgan");
await sheet.Cell("B10").Comments.AddAsync("Approved for sending.");
return await control.GetUserNameAsync();
}
Remarks
Use the member with an instance or settings object from the documented package. Await task-returning operations. Document-bound handles must be resolved again after loading or deleting their owner.