TX Sheet Control

Drawing.GetBarcodeAsync Method

Method
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

Reads detached floating barcode settings, or null for an ordinary drawing.

Syntax

public Task<BarcodeOptions?> GetBarcodeAsync(CancellationToken cancellationToken = default)

Remarks

See Barcodes and QR Codes for a complete .NET example, source validation, mail merge and file compatibility.

Examples

Create and save a label workbook with the configured barcode settings.

using TXTextControl.TXSheetControl.Server;

static async Task<byte[]> CreateFloatingLabelAsync(ServerSheetControl control)
{
    var sheet = await control.Workbook.Sheets.AtAsync(0);
    await sheet.Cell("A1").SetTextAsync("001042");
    var options = new BarcodeDrawingOptions {
        Symbology = "code128", Source = "A1", Anchor = new DrawingAnchor("D4", 8, 8),
        Size = new ObjectSize(240, 100), Name = "Invoice barcode", AltText = "Invoice identifier", Rotation = 0
    };
    var drawing = await sheet.Drawings.AddBarcodeAsync(options);
    var snapshot = await drawing.GetBarcodeAsync();
    await drawing.UpdateBarcodeAsync(new BarcodeOptions { Symbology = "code128", Source = "A1", ShowText = false });
    return await control.SaveAsync(StreamType.SpreadsheetML);
}