[]
IBarcode, IFontOption, ILabelOptionEAN-13 条形码由 12 位数字和 1 位校验位组成。此接口提供对条形码特定选项的访问,例如附加文本及其标签位置,以及由 IBarcode、IFontOption 和 ILabelOption 定义的通用条形码、字体和标签设置。
在下面的示例中,单元格 A1 存储 12 位 EAN-13 主代码,传递给公式的 "12" 是单独的附加文本。
worksheet.getRange("A1").setValue("123456789012");
worksheet.getRange("B1").setFormula("=BC_EAN13(A1,\"rgb(0, 0, 0)\",\"rgb(255, 255, 255)\",1,\"bottom\",\"12\",\"bottom\",,\"normal\",\"normal\",\"none\",\"center\",12,11,7,0,0)");
IEAN13 barcode = (IEAN13) worksheet.getRange("B1").getValue();
String primaryCode = barcode.getValue();
String addOn = barcode.getAddOn();
String addOnLabelPosition = barcode.getAddOnLabelPosition();
getBackgroundColor, getCodeType, getColor, getQuietZoneBottom, getQuietZoneLeft, getQuietZoneRight, getQuietZoneTop, getValuegetFontFamily, getFontSize, getFontStyle, getFontTextAlign, getFontTextDecoration, getFontWeightgetLabelPosition, getShowLabel附加文本是与条形码关联的可选补充代码。存在时,其长度为 2 或 5 个字符。
在下面的示例中,单元格 A1 提供 12 位主代码,传递给公式的 "12" 是单独的附加文本。
worksheet.getRange("A1").setValue("123456789012");
worksheet.getRange("B1").setFormula("=BC_EAN13(A1,\"rgb(0, 0, 0)\",\"rgb(255, 255, 255)\",1,\"bottom\",\"12\",\"bottom\",,\"normal\",\"normal\",\"none\",\"center\",12,11,7,0,0)");
IEAN13 barcode = (IEAN13) worksheet.getRange("B1").getValue();
String primaryCode = barcode.getValue();
String addOn = barcode.getAddOn();
在下面的示例中,单元格 A1 提供 12 位主代码,传递给公式的 "12" 是单独的附加文本。
worksheet.getRange("A1").setValue("123456789012");
worksheet.getRange("B1").setFormula("=BC_EAN13(A1,\"rgb(0, 0, 0)\",\"rgb(255, 255, 255)\",1,\"bottom\",\"12\",\"bottom\",,\"normal\",\"normal\",\"none\",\"center\",12,11,7,0,0)");
IEAN13 barcode = (IEAN13) worksheet.getRange("B1").getValue();
String primaryCode = barcode.getValue();
String addOnLabelPosition = barcode.getAddOnLabelPosition();