TX Sheet Control

ServerSheetControlException Constructor

Constructor
Namespace
TXTextControl.TXSheetControl.Server
Package
TXTextControl.TXSheetControl.Server as TXTextControl.TXSheetControl.Api.dll from the private NuGet feed or the supplied NuGet folder
Also in
TXTextControl.TXSheetControl.Blazor as TXTextControl.TXSheetControl.Api.dll

Syntax

public ServerSheetControlException(string code, string message)

Parameters

ParameterTypeOptionalDescription
codestringNoValue matching code's declared type and the owning object's validation rules.
messagestringNoValue matching message's declared type and the owning object's validation rules.

Return Value

ServerSheetControlException.

Examples

Convert an application-supplied workbook and return a structured failure to the caller. Missing or invalid licenses fail; configure a valid signed token before retrying.

using TXTextControl.TXSheetControl.Server;

async Task<(byte[]? Pdf, string? Error)> TryConvertInvoiceAsync(byte[] workbookBytes, string signedLicense)
{
    try
    {
        await using var control = new ServerSheetControl(new ServerSheetControlOptions { License = signedLicense });
        await control.LoadAsync(workbookBytes, StreamType.SpreadsheetML);
        return (await control.SaveAsync(StreamType.PDF), null);
    }
    catch (ServerSheetControlException error)
    {
        return (null, error.Code + ": " + error.Message);
    }
}

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.

See Also