Show subscripts in IReport, Jasper server and in PDF Export

Requirement: Show number in field value as subscripts in IReport ,Jasper server and in PDF Export.

Softwares used:
Jasper Server 5.6.0
IReport 5.6.0

Here I have created a sample Report to work out on above Requirement

Sample Query:

select ‘H2O’ AS SUBSCRIPT
UNION
SELECT ‘CO2’ AS SUBSCRIPT
UNION
SELECT ‘H3O2’ AS SUBSCRIPT
UNION
SELECT ‘S9O2’ AS SUBSCRIPT
UNION
SELECT ‘HO2CO32’ AS SUBSCRIPT

Output in IReport :

Output in Ireport

But actually we want result in below format

Actual Result

In the above screen shot if we observe, all the Numbers looks like SubScripts.So to Subscript the Numbers please follow the below steps

1.First add Tag to the number, which we want in SubScript

SubScript

In this 1 will come as a subscript

2.To apply the above Tag to a field first change the Markup language as Styled

Markup

3.Next use the Replace function to Replace the Numbers to show as SubScript

FieldName

4.In the above Report field name is SUBSCRIPT and replace the Numbers from 1 to 9

Replace

Output in IReport :

Actual Result

Deployed in server the Output in Jasper server :

ServerOutput

Output in PDF :

PDFOutput

In all browsers this subscript will not work,eg:Mozila and Internet Explorer

To over come the above issue I have created Theme using overrides_custom.css ,and make this theme as a default theme

In the overrides_custom.css add the below code

#reportContainer td {
font-size: xx-small;
}

Thanks,

SatyaGopi

Leave a Reply