# Code49

DsExcel supports Code49 Barcode which is a high-density stacked barcode with two to eight rows. Learn more in DsExcel docs.

## Content

Code 49 is a two dimensional, high-density stacked barcode with two to eight rows (having eight characters each). Each row has a start code and a stop code. This barcode is especially used to encodes the complete ASCII character set.
The below image displays Code49 barcode in a PDF document.
![Code49](https://cdn.mescius.io/document-site-files/images/e333ad47-35da-43f9-a389-25433765f491/images/code49.png)

## Formula definition

You can set Code49 in a worksheet using the following formula:
=BC\_CODE49(value, color, backgroudColor, showLabel, labelPosition, grouping, groupNo, fontFamily, fontStyle, fontWeight, fontTextDecoration, fontTextAlign, fontSize, quietZoneLeft, quietZoneRight, quietZoneTop, quietZoneBottom)

## Parameter

| Name | Description |
| ---- | ----------- |
| value | A string that represents encode on the symbol of Code49. |
| 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. |
| grouping | Specifies whether the symbol mode is Group Alphanimeric Mode. The default value is 'false'. |
| groupNo | A value that represents the index of symbol in the group. The default value is '0' |
| 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 Code49 in the worksheet.

```csharp
// 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 = 10;
worksheet.Range["D:F"].ColumnWidth = 30;
worksheet.Range["4:5"].RowHeight = 80;
worksheet.Range["A:A"].ColumnWidth = 5;
worksheet.Range["B2"].Value = "Code49";
worksheet.Range["B2:F2"].Merge(true);
worksheet.Range["B3:G3"].Value = new object[,]{
    {"Name", "Number", "Defult", "Customer Label Font", "Line Through Label"}
};
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:C5"].Value = new object[,]
  {
    {"Police", "911"},
    {"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 < 6; i++)
{
   var value = "CONCAT(B" + i + ", \": \",C" + i + ")";
   worksheet.Range["D" + i].Formula = "=BC_CODE49" + "(" + value + ")";
   worksheet.Range["E" + i].Formula = "=BC_CODE49" + "(" + value + ", , , true, \"top\", false, 0, \"Arial\", \"normal\", 700)";
   worksheet.Range["F" + i].Formula = "=BC_CODE49" + "(" + value + ", , , , , , , , , 700, \"line - through\", \"left\", \"24px\")";
}

// Save to a pdf file
workbook.Save("code49.pdf");
```