FieldDisplayBarcode class

FieldDisplayBarcode class

Implements the DISPLAYBARCODE field. To learn more, visit the Working with Fields documentation article.

Remarks

Inserts a barcode.

Inheritance: FieldDisplayBarcodeField

Constructors

NameDescription
FieldDisplayBarcode()The default constructor.

Properties

NameDescription
add_start_stop_charGets or sets whether to add Start/Stop characters for barcode types NW7 and CODE39.
background_colorGets or sets the background color of the barcode symbol. Valid values are in the range [0, 0xFFFFFF]
barcode_typeGets or sets the barcode type (QR, etc.)
barcode_valueGets or sets the barcode value.
case_code_styleGets or sets the style of a Case Code for barcode type ITF14. The valid values are [STD
display_resultGets the text that represents the displayed field result.
(Inherited from Field)
display_textGets or sets whether to display barcode data (text) along with image.
endGets the node that represents the field end.
(Inherited from Field)
error_correction_levelGets or sets an error correction level of QR Code. Valid values are [0, 3].
fix_check_digitGets or sets whether to fix the check digit if it’s invalid.
foreground_colorGets or sets the foreground color of the barcode symbol. Valid values are in the range [0, 0xFFFFFF]
formatGets a FieldFormat object that provides typed access to field’s formatting.
(Inherited from Field)
is_dirtyGets or sets whether the current result of the field is no longer correct (stale) due to other modifications made to the document.
(Inherited from Field)
is_lockedGets or sets whether the field is locked (should not recalculate its result).
(Inherited from Field)
locale_idGets or sets the LCID of the field.
(Inherited from Field)
pos_code_styleGets or sets the style of a Point of Sale barcode (barcode types UPCA
resultGets or sets text that is between the field separator and field end.
(Inherited from Field)
scaling_factorGets or sets a scaling factor for the symbol. The value is in whole percentage points and the valid values are [10, 1000]
separatorGets the node that represents the field separator. Can be None.
(Inherited from Field)
startGets the node that represents the start of the field.
(Inherited from Field)
symbol_heightGets or sets the height of the symbol. The units are in TWIPS (1/1440 inch).
symbol_rotationGets or sets the rotation of the barcode symbol. Valid values are [0, 3]
typeGets the Microsoft Word field type.
(Inherited from Field)

Methods

NameDescription
get_field_code()Returns text between field start and field separator (or field end if there is no separator). Both field code and field result of child fields are included.
(Inherited from Field)
get_field_code(include_child_field_codes)Returns text between field start and field separator (or field end if there is no separator).
(Inherited from Field)
remove()Removes the field from the document. Returns a node right after the field. If the field’s end is the last child of its parent node, returns its parent paragraph. If the field is already removed, returns None.
(Inherited from Field)
unlink()Performs the field unlink.
(Inherited from Field)
update()Performs the field update. Throws if the field is being updated already.
(Inherited from Field)
update(ignore_merge_format)Performs a field update. Throws if the field is being updated already.
(Inherited from Field)

Examples

Shows how to insert a DISPLAYBARCODE field, and set its properties.

doc = aw.Document()
builder = aw.DocumentBuilder(doc)
field = builder.insert_field(aw.fields.FieldType.FIELD_DISPLAY_BARCODE, True).as_field_display_barcode()
# Below are four types of barcodes, decorated in various ways, that the DISPLAYBARCODE field can display.
# 1 -  QR code with custom colors:
field.barcode_type = 'QR'
field.barcode_value = 'ABC123'
field.background_color = '0xF8BD69'
field.foreground_color = '0xB5413B'
field.error_correction_level = '3'
field.scaling_factor = '250'
field.symbol_height = '1000'
field.symbol_rotation = '0'
self.assertEqual(' DISPLAYBARCODE  ABC123 QR \\b 0xF8BD69 \\f 0xB5413B \\q 3 \\s 250 \\h 1000 \\r 0', field.get_field_code())
builder.writeln()
# 2 -  EAN13 barcode, with the digits displayed below the bars:
field = builder.insert_field(aw.fields.FieldType.FIELD_DISPLAY_BARCODE, True).as_field_display_barcode()
field.barcode_type = 'EAN13'
field.barcode_value = '501234567890'
field.display_text = True
field.pos_code_style = 'CASE'
field.fix_check_digit = True
self.assertEqual(' DISPLAYBARCODE  501234567890 EAN13 \\t \\p CASE \\x', field.get_field_code())
builder.writeln()
# 3 -  CODE39 barcode:
field = builder.insert_field(aw.fields.FieldType.FIELD_DISPLAY_BARCODE, True).as_field_display_barcode()
field.barcode_type = 'CODE39'
field.barcode_value = '12345ABCDE'
field.add_start_stop_char = True
self.assertEqual(' DISPLAYBARCODE  12345ABCDE CODE39 \\d', field.get_field_code())
builder.writeln()
# 4 -  ITF4 barcode, with a specified case code:
field = builder.insert_field(aw.fields.FieldType.FIELD_DISPLAY_BARCODE, True).as_field_display_barcode()
field.barcode_type = 'ITF14'
field.barcode_value = '09312345678907'
field.case_code_style = 'STD'
self.assertEqual(' DISPLAYBARCODE  09312345678907 ITF14 \\c STD', field.get_field_code())
doc.save(ARTIFACTS_DIR + 'Field.field_display_barcode.docx')

See Also