FieldMergeBarcodePosCodeStyle Property

Gets or sets the style of a Point of Sale barcode (barcode types UPCA|UPCE|EAN13|EAN8). The valid values (case insensitive) are [STD|SUP2|SUP5|CASE].

Namespace:  Aspose.Words.Fields
Assembly:  Aspose.Words (in Aspose.Words.dll) Version: 20.5
public string PosCodeStyle { get; set; }

Property Value

Type: String
Shows how to perform a mail merge on EAN13 barcodes.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);

// Insert a MERGEBARCODE field,
// which functions similar to a MERGEFIELD by creating a barcode from the merged data source's values
// This field will convert all rows in a merge data source's "MyEAN13Barcode" column into EAN13 barcodes
FieldMergeBarcode field = (FieldMergeBarcode)builder.InsertField(FieldType.FieldMergeBarcode, true);
field.BarcodeType = "EAN13";
field.BarcodeValue = "MyEAN13Barcode";

// Edit its appearance to display barcode data under the lines
field.DisplayText = true;
field.PosCodeStyle = "CASE";
field.FixCheckDigit = true;

Assert.AreEqual(FieldType.FieldMergeBarcode, field.Type);
Assert.AreEqual(" MERGEBARCODE  MyEAN13Barcode EAN13 \\t \\p CASE \\x", field.GetFieldCode());

// Create a DataTable with a column with the same name as our MERGEBARCODE field's BarcodeValue
// When we execute the mail merge,
// a barcode of a type we specified in the MERGEBARCODE field will be created with each row's value
DataTable table = new DataTable("Barcodes");
table.Rows.Add(new[] { "501234567890" });
table.Rows.Add(new[] { "123456789012" });


// Every row in the "MyEAN13Barcode" column has created a DISPLAYBARCODE field,
// which shows a barcode with the merged value
Assert.AreEqual(FieldType.FieldDisplayBarcode, doc.Range.Fields[0].Type);
Assert.AreEqual("DISPLAYBARCODE \"501234567890\" EAN13 \\t \\p CASE \\x",
Assert.AreEqual(FieldType.FieldDisplayBarcode, doc.Range.Fields[1].Type);
Assert.AreEqual("DISPLAYBARCODE \"123456789012\" EAN13 \\t \\p CASE \\x",

doc.Save(ArtifactsDir + "Field.MERGEBARCODE.EAN13.docx");
See Also