Code 39 is a linear barcode that uses a total of nine bars to represent each symbol which includes numeric characters, upper case characters and some special characters ("%" , "*", "$", "/", "." , "-", "+").
The below image displays Code39 barcode in a PDF document.
You can set Code39 in a worksheet using the following formula:
=BC_CODE39(value, color, backgroundColor, showLabel, labelPosition, labelWithStartAndStopCharacter, checkDigit, nwRatio, fullASCII, fontFamily, fontStyle, fontWeight, fontTextDecoration, fontTextAlign, fontSize, quietZoneLeft, quietZoneRight, quietZoneTop, quietZoneBottom)
Name | Description |
---|---|
value | A string that represents encode on the symbol of Code39. |
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. |
labelWithStartAndStopCharacter | Specifies whether to show the start and stop character in the label. The default value is 'false'. |
checkDigit | Specifies whether the symbol needs a check digit. The default value is 'false'. |
nwRatio | A value that represents the wide and narrow bar ratio. It has values 2|3. The default value is '3'. |
fullASCII | Specifies whether to support full ASCII for Code39. The default value is 'false'. |
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. |
This example code sets Code39 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:C"].ColumnWidth = 15; worksheet.Range["D:H"].ColumnWidth = 25; worksheet.Range["4:6"].RowHeight = 60; worksheet.Range["A:A"].ColumnWidth = 5; worksheet.Range["B2"].Value = "Code39"; worksheet.Range["B2:F2"].Merge(true); worksheet.Range["B3:H3"].Value = new object[,]{ {"Name", "Number", "Defult", "Change labelWithStartAndStopCharacter", "Change checkDigit", "Change checkDigit", "Change nwRatio", "Change fullASCII"} }; 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:C6"].Value = new object[,] { {"Paper", "6922266446146"}, {"Book", "9787560044231"}, {"Value can contain some symbol", "1234+-#*"} }; worksheet.Range["B4:C6"].WrapText = true; worksheet.Range["G6"].WrapText = true; worksheet.PageSetup.PrintTitleColumns = "$A:$C"; worksheet.PageSetup.Orientation = PageOrientation.Landscape; worksheet.PageSetup.PrintGridlines = true; // Set formula for (var i = 4; i < 7; i++) { worksheet.Range["D" + i].Formula = "=BC_CODE39" + "(C" + i + ")"; worksheet.Range["E" + i].Formula = "=BC_CODE39" + "(C" + i + ",,,,,\"true\")"; worksheet.Range["F" + i].Formula = "=BC_CODE39" + "(C" + i + ",,,,,,\"true\")"; worksheet.Range["G" + i].Formula = "=BC_CODE39" + "(C" + i + ",,,,,,,2)"; worksheet.Range["H" + i].Formula = "=BC_CODE39" + "(C" + i + ",,,,,,,,\"true\")"; } // Save to a pdf file workbook.Save("code39.pdf"); |