Back to Devexpress

DataMatrixGenerator.CompactionMode Property

corelibraries-devexpress-dot-xtraprinting-dot-barcode-dot-datamatrixgenerator.md

latest4.5 KB
Original Source

DataMatrixGenerator.CompactionMode Property

Gets or sets whether text or binary mode should be used to encode the barcode’s data.

Namespace : DevExpress.XtraPrinting.BarCode

Assembly : DevExpress.Printing.v25.2.Core.dll

NuGet Package : DevExpress.Printing.Core

Declaration

csharp
[DefaultValue(DataMatrixCompactionMode.ASCII)]
public virtual DataMatrixCompactionMode CompactionMode { get; set; }
vb
<DefaultValue(DataMatrixCompactionMode.ASCII)>
Public Overridable Property CompactionMode As DataMatrixCompactionMode

Property Value

TypeDefaultDescription
DataMatrixCompactionModeASCII

A DataMatrixCompactionMode enumeration value.

|

Available values:

NameDescription
ASCII

Data is encoded into text using the ASCII standard, which uses 4 bits (for double digits), 8 bits (for ASCII 0-127 symbols), or 16 bits (for ASCII 128-255 symbols).

| | C40 |

Data is encoded into text using the C40 standard, which uses 5.33 bits (for upper register characters and digits) or 10.66 bits (for lower register and special characters) per symbol.

| | Text |

Data is encoded into text, which uses 5.33 bits (for upper register characters and digits) or 10.66 bits (for lower register and special characters) per symbol.

| | X12 |

Data is encoded into text using the X12 standard, which uses 5.33 bits (for upper register characters, digits and the three standard ANSI X12 terminator and separator characters) or 10.66 bits (for lower register and special characters) per symbol.

| | Edifact |

Data is encoded into text using the EDIFACT standard, which uses 6 bits per symbol.

| | Binary |

Data is encoded into a binary array, using 8 bits per symbol.

|

Remarks

If the data encoded in text mode contains invalid characters for ECC200 - Data Matrix, switch to binary mode to interpret the data as a sequence of bytes and use this sequence to encode the barcode.

Set the barcode’s CompactionMode property to Binary to enable binary mode. To specify binary data to encode the barcode, do one of the following:

  • Transform the data into a sequence of bytes and assign the sequence to the barcode’s BinaryData property.
  • Assign the data to the barcode’s Text property to automatically use UTF-8 to convert the data into a sequence of bytes.

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the CompactionMode property.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

reporting-add-a-bar-code-to-a-report/CS/Form1.cs#L281

csharp
// Adjust the properties specific to the bar code type.
((DataMatrixGenerator)barCode.Symbology).CompactionMode = DataMatrixCompactionMode.Text;
((DataMatrixGenerator)barCode.Symbology).MatrixSize = DataMatrixSize.MatrixAuto;

See Also

ECC200 - Data Matrix

DataMatrixGenerator Class

DataMatrixGenerator Members

DevExpress.XtraPrinting.BarCode Namespace