PosCodeStyle
内容
[
隐藏
]FieldDisplayBarcode.PosCodeStyle property
获取或设置销售点条形码的样式(条形码类型 UPCA|UPCE|EAN13|EAN8)。有效值(不区分大小写)为 [STD|SUP2|SUP5|CASE].
public string PosCodeStyle { get; set; }
例子
演示如何插入 DISPLAYBARCODE 字段并设置其属性。
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
FieldDisplayBarcode field = (FieldDisplayBarcode)builder.InsertField(FieldType.FieldDisplayBarcode, true);
// 下面是 DISPLAYBARCODE 字段可以显示的四种类型的条形码,以各种方式装饰。
// 1 - 具有自定义颜色的 QR 码:
field.BarcodeType = "QR";
field.BarcodeValue = "ABC123";
field.BackgroundColor = "0xF8BD69";
field.ForegroundColor = "0xB5413B";
field.ErrorCorrectionLevel = "3";
field.ScalingFactor = "250";
field.SymbolHeight = "1000";
field.SymbolRotation = "0";
Assert.AreEqual(" DISPLAYBARCODE ABC123 QR \\b 0xF8BD69 \\f 0xB5413B \\q 3 \\s 250 \\h 1000 \\r 0", field.GetFieldCode());
builder.Writeln();
// 2 - EAN13 条形码,数字显示在条形下方:
field = (FieldDisplayBarcode)builder.InsertField(FieldType.FieldDisplayBarcode, true);
field.BarcodeType = "EAN13";
field.BarcodeValue = "501234567890";
field.DisplayText = true;
field.PosCodeStyle = "CASE";
field.FixCheckDigit = true;
Assert.AreEqual(" DISPLAYBARCODE 501234567890 EAN13 \\t \\p CASE \\x", field.GetFieldCode());
builder.Writeln();
// 3 - CODE39 条形码:
field = (FieldDisplayBarcode)builder.InsertField(FieldType.FieldDisplayBarcode, true);
field.BarcodeType = "CODE39";
field.BarcodeValue = "12345ABCDE";
field.AddStartStopChar = true;
Assert.AreEqual(" DISPLAYBARCODE 12345ABCDE CODE39 \\d", field.GetFieldCode());
builder.Writeln();
// 4 - ITF4 条形码,具有指定的案例代码:
field = (FieldDisplayBarcode)builder.InsertField(FieldType.FieldDisplayBarcode, true);
field.BarcodeType = "ITF14";
field.BarcodeValue = "09312345678907";
field.CaseCodeStyle = "STD";
Assert.AreEqual(" DISPLAYBARCODE 09312345678907 ITF14 \\c STD", field.GetFieldCode());
doc.Save(ArtifactsDir + "Field.DISPLAYBARCODE.docx");
也可以看看
- class FieldDisplayBarcode
- 命名空间 Aspose.Words.Fields
- 部件 Aspose.Words