[]
        
(Showing Draft Content)

IBarcode

Interface IBarcode

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

public interface IBarcode
Represents the common interface for all barcode types.

All barcode types inherit this interface. It provides the shared barcode information, including the encoded value, barcode color, background color, barcode type, and quiet-zone sizes.


 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()
      Gets the string encoded in the barcode symbol.
      
       worksheet.getRange("A1").setFormula("=BC_QRCODE(\"https://www.example.com\")");
       IBarcode barcode = (IBarcode) worksheet.getRange("A1").getValue();
       String value = barcode.getValue();
       
      Returns:
      The string encoded in the barcode symbol.
    • getColor

      String getColor()
      Gets the barcode color.

      This property returns the color used to render the barcode symbol. The default value is "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:
      The barcode color as a string, such as "rgb(0,0,0)".
    • getBackgroundColor

      String getBackgroundColor()
      Gets the barcode background color.

      This property returns the color used for the barcode background. The default value is "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:
      The barcode background color as a string, such as "rgb(255, 255, 255)".
    • getCodeType

      BarcodeType getCodeType()
      Gets the barcode type.

      Returns the BarcodeType value that identifies the symbology used by this barcode, such as BarcodeType.QRCode or BarcodeType.PDF417.

      
       worksheet.getRange("A1").setFormula("=BC_QRCODE(\"https://www.example.com\")");
       IBarcode barcode = (IBarcode) worksheet.getRange("A1").getValue();
       BarcodeType codeType = barcode.getCodeType();
       
      Returns:
      The BarcodeType value that represents the symbology of this barcode.
    • getQuietZoneLeft

      int getQuietZoneLeft()
      Gets the size of the left quiet zone.

      This property returns the margin size to the left of the barcode symbol. If the left quiet zone is not specified, this method returns 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:
      A value that represents the size of left quiet zone.
    • getQuietZoneRight

      int getQuietZoneRight()
      Gets the size of the right quiet zone.

      This property returns the margin size to the right of the barcode symbol.

      
       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:
      A value that represents the size of right quiet zone.
    • getQuietZoneTop

      int getQuietZoneTop()
      Gets the size of the top quiet zone.

      This property returns the margin size above the barcode symbol.

      
       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:
      The size of the top quiet zone.
    • getQuietZoneBottom

      int getQuietZoneBottom()
      Gets the size of the bottom quiet zone.

      This property returns the margin size below the barcode symbol.

      
       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:
      The size of the bottom quiet zone.