Whether you are in a small business or a large industry, the use of labeling is a basic need for many types of products. You may need asset management tags and labels for inventory documentation. You may also need labels for mailing and packaging.
There are many vendors like Avery or OnlineLabels.com that can provide labels in various sizes and layouts fulfilling your specific business needs. However, it can be challenging to print data on the labels. Before printing the label, you need to generate a label template and adjust the data to fit the label dimensions. ActiveReports can help with designing the template, binding to desired data, and preparing a print-ready file, all at one place.
Let’s understand this through a use-case—the banking industry. Suppose you are working for a banking organization and need to send a letter regarding the changes in the bank's policies to customers. Considering the large number of customers your bank has, you may want to make use of printed labels for the customer addresses.
The personal information about the customer is available in JSON format, through a web-service from the system that the bank is using for maintaining its data. In order to print the data on the physical labels, you'll need a label template that can bind with the JSON file.
You can find a Word or PDF template online for the label you are using, but it may not be easy to fetch data from a JSON file in these templates. In this case, you might either need a third-party tool, or you can contact the label vendor to do this data binding for you.
In this blog, we’ll see how to use a data region (Tablix) within RDL report type in ActiveReports to design the label report, taking Avery 5160 Label template as an example whose dimensions are as shown below:
Let’s get started to see how this report can be designed using ActiveReports.
As a first step towards designing the desired layout, we'll add the Tablix control from Toolbox to the designer in an RDL report.
Note: If you want to use other data regions – List or Table or different report type – Page or Section for designing this report, you see this article about label reports.
Next, we'll delete the following from the default 2x2 grid to get the layout as shown below:
First column in the Tablix.
First row containing the corner cell and column group cell.
We’ll add rows depending on the data to show on the label. Here, we’ll add 4 rows to display Contact Name, Street address, City with Postal Code and Country in the label as shown below:
The next step is to adjust the Tablix size according to the Avery 5160 dimensions.
We’ll select the Tablix and set its “Width” and “Height” to 2.63 in and 1 in respectively. Additionally, we'll set the Tablix’s Top and Left Location to 0 in.
The report at this point appears as shown below:
This is the final step with layout designing. Here, we’ll set the properties of report’s body – columns, size, and margins, to match the actual Avery Label sheet.
Columns = 3, equal to the number of columns in the avery label sheet
ColumnSpacing = 0.12in, representing the horizontal pitch
Size.Width = 2.63in and Size.Height =1in, equal to a label size
Margins.Left = 0.19in, Margin.Right = 0.18in, Margin.Top = Margin.Bottom = 0.5in
Paper = Letter (8.5 x 11in)
As the layout is ready, it's time to fetch the data for the label.
In this blog, we will use “customer.json” sample datasource that ships with the ActiveReports installer. Learn more about how to bind a report to JSON data fetched from a web-service.
Once the data is there, we’ll bind the cells in Tablix with required fields. Add grouping on key data (ID) to show distinct customer data in the labels.
We’ll format the label to match the text style required on the printed label. The report will appear in the designer as shown below, after adjusting the row height, applying font style ,and adding a border.
The report is now ready for preview and it appears in the ActiveReports Viewer as shown below:
You can now print on a physical label. With ActiveReports, you can do this two ways: printing directly from the ActiveReports Viewer or printing an exported file, such as a PDF file.
While printing, ensure that the page scaling is set to “No Scaling” or the size options are set to “Actual Size” to avoid any alignment issues on the actual label.
Now you can design and print report labels. In this article, we used Avery Label as an example; however, with ActiveReports, you can design any label layout of your choice. This includes address labels, shipping labels, product labels, security labels, files, folder labels, and more. Additionally, you can design for any label provider (Avery Labels or OnlineLabels.com).
If you have any questions or comments, please leave in the thread below.