TX Sheet Control

BarcodeDrawingOptions.Size Property

Property
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

Width and height in unscaled CSS pixels. Defaults to 160×160 for QR or 280×100 for linear codes.

Syntax

public ObjectSize? Size { get; init; }

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);
}