Jump to content

Jasper Report HTML Preview Spaces Issues


Go to solution Solved by Thomas Tibcken,

Recommended Posts

I've created a jasper report by using Jaspersoft studio.In my report I've only 2 textfields which contains strings and I've placed one textfield on LHS and second textfield on RHS.When I open the preview in PDF and Java It's giving fine but in HTML preview it's givng some extra spaces on LHS and RHS.How can I remove these spaces in HTML preview?

Here's my Jrxml code

 

<?xml version="1.0" encoding="UTF-8"?>
<!-- Created with Jaspersoft Studio version 6.20.6.final using JasperReports Library version 6.20.6-5c96b6aa8a39ac1dc6b6bea4b81168e16dd39231  -->
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="Test" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="ebf35dbb-b084-4b9d-952b-390e89df01c1">
    <property name="com.jaspersoft.studio.data.defaultdataadapter" value="Activity Data Adapter"/>
    <queryString language="json">
        <![CDATA[]]>
    </queryString>
    <background>
        <band splitType="Stretch"/>
    </background>
    <title>
        <band height="79" splitType="Stretch"/>
    </title>
    <pageHeader>
        <band height="35" splitType="Stretch"/>
    </pageHeader>
    <columnHeader>
        <band height="61" splitType="Stretch"/>
    </columnHeader>
    <detail>
        <band height="125" splitType="Stretch">
            <textField>
                <reportElement x="-16" y="42" width="100" height="30" uuid="a48f45de-e859-4e55-85b8-fed076121d14">
                    <property name="com.jaspersoft.studio.unit.x" value="px"/>
                </reportElement>
                <textFieldExpression><![CDATA["New"]]></textFieldExpression>
            </textField>
            <textField>
                <reportElement x="472" y="42" width="100" height="30" uuid="a98fb27c-8215-45d5-85aa-a1ff4fb6e7d7">
                    <property name="com.jaspersoft.studio.unit.y" value="px"/>
                </reportElement>
                <textElement textAlignment="Right"/>
                <textFieldExpression><![CDATA["Report"]]></textFieldExpression>
            </textField>
        </band>
    </detail>
    <columnFooter>
        <band height="45" splitType="Stretch"/>
    </columnFooter>
    <pageFooter>
        <band height="54" splitType="Stretch"/>
    </pageFooter>
    <summary>
        <band height="42" splitType="Stretch"/>
    </summary>
</jasperReport>

Here's HTML Preview

 

 

Screenshot from 2024-02-20 09-58-13.png

Link to comment
Share on other sites

  • 2 weeks later...

Hi Shahbaz Ali, 

 

can you please tell us more about your environment like version of Jaspersoft, OS of Studio and Server.

Can you provide a simple example and upload it as a .jrxml (no copy&paste of code), so we can try to reproduce what you describe. 

 

THX TT

Link to comment
Share on other sites

13 hours ago, Thomas Tibcken said:

Hi Shahbaz Ali, 

 

can you please tell us more about your environment like version of Jaspersoft, OS of Studio and Server.

Can you provide a simple example and upload it as a .jrxml (no copy&paste of code), so we can try to reproduce what you describe. 

 

THX TT

I've jaspersoft studio 6.20.6 and OS is ubuntu 22.04

Here's my jrxml file

Test.jrxml

Link to comment
Share on other sites

Hi Shahbaz Ali, 

thx for providing the example. What you see is the same pixel perfect result for all Formats. 

Jaspersoft HTML Reports output is not like a responsive HTML Web-Page - it will center the Report and keep all pixel from the template as defined. 

image.thumb.png.679447f23dc18bc4a45d7ec42c6b1c08.png

In your example you use the A4 Page / Unit Pixel ... you would need % of the screen to make  it responsive. 

image.thumb.png.694b664715f6d901c0dd0b2983958dd5.png

I will check if there is a propertie for HTML Format to generate a HTML Report with reponsive layout. 

Regards TT

 

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...