[]
        
首页
开发者学堂
文档
论坛
市场
生态机会
活动
立即试用
(Showing Draft Content)

IBarcode

Interface IBarcode

All Known Subinterfaces:
ICodabar, ICode128, ICode39, ICode49, ICode93, IDataMatrix, IEAN13, IEAN8, IGS1128, IPDF417, IQRCode

public interface IBarcode
表示所有条形码类型的公共接口。

所有条形码类型都继承此接口。它提供共享的条形码信息,包括编码值、条形码颜色、背景颜色、条形码类型和静区大小。


 worksheet.getRange("A1").setFormula("=BC_QRCODE(\"https://www.example.com\",\"rgb(255, 0, 0)\",\"rgb(255, 255, 0)\",\"H\",1,\"auto\",\"auto\",FALSE,0,,\"UTF-8\",1,2,3,4)");
 IBarcode barcode = (IBarcode) worksheet.getRange("A1").getValue();
 String color = barcode.getColor();
 String backgroundColor = barcode.getBackgroundColor();
 BarcodeType codeType = barcode.getCodeType();
 
  • Method Details

    • getValue

      String getValue()
      获取条形码符号中编码的字符串。
      
       worksheet.getRange("A1").setFormula("=BC_QRCODE(\"https://www.example.com\")");
       IBarcode barcode = (IBarcode) worksheet.getRange("A1").getValue();
       String value = barcode.getValue();
       
      Returns:
      条形码符号中编码的字符串。
    • getColor

      String getColor()
      获取条形码颜色。

      此属性返回用于呈现条形码符号的颜色。默认值为 "rgb(0,0,0)"。

      
       worksheet.getRange("A1").setFormula("=BC_QRCODE(\"https://www.example.com\",\"rgb(255, 0, 0)\")");
       IBarcode barcode = (IBarcode) worksheet.getRange("A1").getValue();
       String color = barcode.getColor();
       
      Returns:
      条形码颜色字符串,例如 "rgb(0,0,0)"。
    • getBackgroundColor

      String getBackgroundColor()
      获取条形码背景颜色。

      此属性返回用于条形码背景的颜色。默认值为 "rgb(255, 255, 255)"。

      
       worksheet.getRange("A1").setFormula("=BC_QRCODE(\"https://www.example.com\",\"rgb(255, 0, 0)\",\"rgb(255, 255, 0)\")");
       IBarcode barcode = (IBarcode) worksheet.getRange("A1").getValue();
       String backgroundColor = barcode.getBackgroundColor();
       
      Returns:
      条形码背景颜色字符串,例如 "rgb(255, 255, 255)"。
    • getCodeType

      BarcodeType getCodeType()
      获取条形码类型。

      返回用于标识此条形码所用符号体系的 BarcodeType 值,例如 BarcodeType.QRCode 或 BarcodeType.PDF417。

      
       worksheet.getRange("A1").setFormula("=BC_QRCODE(\"https://www.example.com\")");
       IBarcode barcode = (IBarcode) worksheet.getRange("A1").getValue();
       BarcodeType codeType = barcode.getCodeType();
       
      Returns:
      表示此条形码码制类型的 BarcodeType 值。
    • getQuietZoneLeft

      int getQuietZoneLeft()
      获取左侧静区的大小。

      此属性返回条形码符号左侧的边距大小。如果未指定左侧静区,此方法返回 0。

      
       worksheet.getRange("A1").setFormula("=BC_QRCODE(\"https://www.example.com\",\"rgb(0, 0, 0)\",\"rgb(255, 255, 255)\",\"L\",2,\"auto\",\"auto\",FALSE,0,,\"UTF-8\",1,2,3,4)");
       IBarcode barcode = (IBarcode) worksheet.getRange("A1").getValue();
       int quietZoneLeft = barcode.getQuietZoneLeft();
       
      Returns:
      表示左侧静区大小的值。
    • getQuietZoneRight

      int getQuietZoneRight()
      获取右侧静区的大小。

      此属性返回条形码符号右侧的边距大小。

      
       worksheet.getRange("A1").setFormula("=BC_QRCODE(\"https://www.example.com\",\"rgb(0, 0, 0)\",\"rgb(255, 255, 255)\",\"L\",2,\"auto\",\"auto\",FALSE,0,,\"UTF-8\",1,2,3,4)");
       IBarcode barcode = (IBarcode) worksheet.getRange("A1").getValue();
       int quietZoneRight = barcode.getQuietZoneRight();
       
      Returns:
      表示右侧静区大小的值。
    • getQuietZoneTop

      int getQuietZoneTop()
      获取顶部静区的大小。

      此属性返回条形码符号上方的边距大小。

      
       worksheet.getRange("A1").setFormula("=BC_QRCODE(\"https://www.example.com\",\"rgb(0, 0, 0)\",\"rgb(255, 255, 255)\",\"L\",2,\"auto\",\"auto\",FALSE,0,,\"UTF-8\",1,2,3,4)");
       IBarcode barcode = (IBarcode) worksheet.getRange("A1").getValue();
       int quietZoneTop = barcode.getQuietZoneTop();
       
      Returns:
      顶部静区的大小。
    • getQuietZoneBottom

      int getQuietZoneBottom()
      获取底部静区的大小。

      此属性返回条形码符号下方的边距大小。

      
       worksheet.getRange("A1").setFormula("=BC_QRCODE(\"https://www.example.com\",\"rgb(0, 0, 0)\",\"rgb(255, 255, 255)\",\"L\",2,\"auto\",\"auto\",FALSE,0,,\"UTF-8\",1,2,3,4)");
       IBarcode barcode = (IBarcode) worksheet.getRange("A1").getValue();
       int quietZoneBottom = barcode.getQuietZoneBottom();
       
      Returns:
      底部静区的大小。