Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to center align barcode using jasperreports and barcode4j

I use iReport 5.5.0. How to center align a barcode component?

Relevant fragment of my jrxml is below.

        <componentElement>
            <reportElement x="0" y="9" width="113" height="36" uuid="a11badb4-7c31-4011-83ae-f287b457939a"/>
            <jr:Code128 xmlns:jr="http://jasperreports.sourceforge.net/jasperreports/components" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports/components http://jasperreports.sourceforge.net/xsd/components.xsd" textPosition="bottom">
                <jr:codeExpression><![CDATA[$F{number}]]></jr:codeExpression>
            </jr:Code128>
        </componentElement>
like image 679
ThomasEdwin Avatar asked Apr 21 '14 15:04

ThomasEdwin


People also ask

How do I align text in Jasper report?

Select the text filed, select "Properties" tab and select center icon in the "Text Alignment". Vote up!

What is JasperReports library?

JasperReports Library is an open source reporting engine, written entirely in Java. JasperReports Library is able to use data coming from any kind of data source and produce documents that can viewed, printed, or exported in a variety of document formats, including HTML, PDF, Excel, OpenOffice and Word.


1 Answers

Create a style, let's call it "Barcode", like:

<style name="Barcode" fontName="Helvetica" fontSize="10" hAlign="Center" vAlign="Middle"/>

and set the style property of your barcode element to "Barcode".

like image 136
Laura Avatar answered Sep 16 '22 14:09

Laura