Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7778099
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T18:18:42+00:00 2026-06-01T18:18:42+00:00

I have a table in iReport which generates to a PDF correctly: <componentElement> <reportElement

  • 0

I have a table in iReport which generates to a PDF correctly:

<componentElement>
    <reportElement key="server vendor table" style="table" x="272" y="437" width="150" height="115"/>
    <jr:table>
        <jr:column width="50">
            <jr:columnHeader style="table_CH" height="15" rowSpan="1">
                <staticText>
                    <reportElement x="5" y="0" width="45" height="15"/>
                    <textElement/>
                    <text><![CDATA[Server Vendor]]></text>
                </staticText>
            </jr:columnHeader>
            <jr:detailCell style="table_TD" height="18" rowSpan="1">
                <textField>
                    <reportElement x="5" y="0" width="45" height="15"/>
                    <textElement/>
                    <textFieldExpression><![CDATA[$F{vendor}]]></textFieldExpression>
                </textField>
            </jr:detailCell>
        </jr:column>
        <jr:column width="50">
            <jr:columnHeader style="table_CH" height="15" rowSpan="1">
                <staticText>
                    <reportElement x="5" y="0" width="45" height="15"/>
                    <textElement/>
                    <text><![CDATA[# Hosts]]></text>
                </staticText>
            </jr:columnHeader>
            <jr:detailCell style="table_TD" height="18" rowSpan="1">
                <textField>
                    <reportElement x="5" y="0" width="45" height="15"/>
                    <textElement/>
                    <textFieldExpression><![CDATA[$F{count}]]></textFieldExpression>
                </textField>
            </jr:detailCell>
        </jr:column>
        <jr:column width="50">
            <jr:columnHeader style="table_CH" height="15" rowSpan="1">
                <staticText>
                    <reportElement x="5" y="0" width="45" height="15"/>
                    <textElement/>
                    <text><![CDATA[Host %]]></text>
                </staticText>
            </jr:columnHeader>
            <jr:detailCell style="table_TD" height="18" rowSpan="1">
                <textField>
                    <reportElement x="5" y="0" width="45" height="15"/>
                    <textElement/>
                    <textFieldExpression><![CDATA[$F{pc}]]></textFieldExpression>
                </textField>
            </jr:detailCell>
        </jr:column>
    </jr:table>
</componentElement>

When generating the report from iReport, the PDF is generated correctly, the result is:
Correct result generated using iReport

But when generated using Java the text entry for “HP” in the first column is split across multiple lines:
Wrong result generated using Java code

Note that only the “HP” text is split – longer text with a space in it (e.g. “Dell inc.”) is not split.

I’m guessing that I need to set some properties, but I can’t see figure out which property I need to set.

Class.forName("org.postgresql.Driver");
Connection conn = DriverManager.getConnection("jdbc:postgresql://localhost:5432/hardwaredata","???","???");       
InputStream input = new FileInputStream(new File("/reports/hardware_report.jrxml"));
JasperDesign design = JRXmlLoader.load(input);
input.close();
Map<String, Object> param_map = new HashMap<String, Object>();
JasperReport jReport = JasperCompileManager.compileReport(design);
JasperPrint jPrint = JasperFillManager.fillReport(jReport, param_map, conn);
String path = application.getRealPath("/") + "/"+"static_report.pdf";
JasperExportManager.exportReportToPdfFile(jPrint, path);
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T18:18:43+00:00Added an answer on June 1, 2026 at 6:18 pm

    I have seen this before. I don’t recall finding the true cause. Equally strangely (but happily) I found that strings like “HP ” don’t exhibit this behavior.

    Try changing your text field to display this: $F{Vendor} + " "

    Be sure to also log a bug! But that might be good enough to solve immediate problems.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have table with a unique auto-incremental primary key. Over time, entries may be
I have table A in Oracle that has a primary key (id). I need
I have table in my database which has fields of ID,NAME,CONTEXT. I am showing
I have table the following data structure in SQL Server: ID Date Allocation 1,
I have table A(id). I need to create table B(id) add a foreign key
I have table view which is showing list of files to download. When I
I have table named A with column B defined int not null Primary Key
I have table with 3 columns: id (of person), city (which person visited) and
I have table which will only contain information about files, so, as the file
I have table named as contacts which has nearly 1.2 million records we use

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.