Document Solutions for Excel, .NET Edition | Document Solutions
Features / Barcodes / GS1-128
In This Topic
    GS1-128
    In This Topic

    GS1-128 is a barcode that uses a series of application Identifiers in order to encode data. It makes use of the complete ASCII character set while also using FNC1 character as the first character position. This barcode is especially used for dates, batch numbers, weights and HIBC applications etc.

    The below image displays GS1-128 barcode in a PDF document.

    GS1_128

    Formula definition

    You can set GS1-128 in a worksheet using the following formula:

    =BC_GS1_128(value, color, backgroudColor, showLabel, labelPosition, fontFamily, fontStyle, fontWeight, fontTextDecoration, fontTextAlign, fontSize, quietZoneLeft, quietZoneRight, quietZoneTop, quietZoneBottom)

    Parameter

    Name Description
    value A string that represents encode on the symbol of GS1-128.
    color A color that represents the barcode color. The default value is 'rgb(0,0,0)'.
    backgroundColor A color that represents the barcode backgroundcolor. The default value is 'rgb(255, 255, 255)'
    showLabel Specifies whether to show label text when the barcode has label.
    labelPosition ​A value that represents the label position when the label is shown.
    fontFamily A string that represents the label text fontFamily. The default value is 'sans-serif'.
    fontStyle A string that represents the label text fontStyle. The default value is 'normal'.
    fontWeight A string that represents the label text fontWeight. The default value is 'normal'.
    fontTextDecoration A string that represents the label text fontTextDecoration. The default value is 'none'.
    fontTextAlign A string that represents the label text fontTextAlign. The default value is 'center'.
    fontSize A string that represents the label text fontSize. The default value is '12px'.
    quietZoneLeft A value that represents the size of left quiet zone.
    quietZoneRight A value that represents the size of right quiet zone.
    quietZoneTop A value that represents the size of top quiet zone.
    quietZoneBottom A value that represents the size of bottom quiet zone.

    Using Code

    This example code sets GS1_128 in the worksheet.

    C#
    Copy Code
    // Create a new workbook
    var workbook = new GrapeCity.Documents.Excel.Workbook();
    
    // Set worksheet layout and data
    IWorksheet worksheet = workbook.Worksheets[0];
    worksheet.Range["B:F"].ColumnWidth = 20;
    worksheet.Range["4:7"].RowHeight = 60;
    worksheet.Range["A:A"].ColumnWidth = 5;
    worksheet.Range["B2"].Value = "GS1128";
    worksheet.Range["B2:F2"].Merge(true);
    worksheet.Range["B3:F3"].Value = new object[,]{
        {"Name", "Number", "Defult", "Hidden Label", "Custom Label Font"}
    };
    worksheet.Range["B4:C7"].HorizontalAlignment = HorizontalAlignment.Center;
    worksheet.Range["B4:C7"].VerticalAlignment = VerticalAlignment.Center;
    worksheet.Range["B2:F3"].HorizontalAlignment = HorizontalAlignment.Center;
    worksheet.Range["B2:F3"].VerticalAlignment = VerticalAlignment.Center;
    worksheet.Range["B4:C7"].Value = new object[,]
      {
        {"Police", 911},
        {"Telephone Directory Assistance", 411},
        {"Non-emergency Municipal Services", 311},
        {"Travel Info Call 511", 511}
      };
    worksheet.Range["B4:C6"].WrapText = true;
    worksheet.Range["G6"].WrapText = true;
    worksheet.PageSetup.PrintGridlines = true;
    worksheet.PageSetup.Orientation = PageOrientation.Landscape;
    
    // Set formula
    for (var i = 4; i < 8; i++)
    {
       worksheet.Range["D" + i].Formula = "=BC_CODE128" + "(C" + i + ")";
       worksheet.Range["E" + i].Formula = "=BC_CODE128" + "(C" + i + ", , , false))";
       worksheet.Range["F" + i].Formula = "=BC_CODE128" + "(C" + i + ", , , true, \"top\", \"Arial\", \"normal\")";
    }
    
    // Save to a pdf file
    workbook.Save("gs1128.pdf");