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 8252385
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T00:33:07+00:00 2026-06-08T00:33:07+00:00

I have a report where the export result in pdf and csv differ in

  • 0

I have a report where the export result in pdf and csv differ in some columns and I want to use the same template for both exports. CSV would have more or less columns compared to PDF output. Im using JRCsvMetadataExporter as my CSV exporter. So what I tried to do is create a separate band for CSV and PDF, In the band intended for CSV, my code was like

<band height="0">
  <printWhenExpression><![CDATA[Boolean.FALSE]]></printWhenExpression>
  <textField>
      <reportElement x="0" y="0" width="119" height="0">
            <property name="net.sf.jasperreports.export.csv.column.name" value="Column_1"/>
             <propertyExpression name="net.sf.jasperreports.export.csv.data"><![CDATA[$F{COL_1}]]></propertyExpression>
       </reportElement>
   </textField>
</band>

But when I ran the export, nothing was getting generated for CSV, I was expecting when printWhenExpression is false, it wont be included in the PDF export and CSV exporter will include columns mentioned in the band. Could anyone let me know what Im doing wrong here?

  • 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-08T00:33:09+00:00Added an answer on June 8, 2026 at 12:33 am

    If printWhenExpression is hard coded with Boolean.FALSE then it will never appear in PDF and CSV. Try to add the element with width and height as 0 in the jrxml which will make it not appear in the PDF but it will appear in the CSV since you are using the JRCsvMetadataExporter

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

Sidebar

Related Questions

I have a simple report that I want to export to a CSV file.
If you have two versions of the same report (.rpt) and you want to
We're running into the same problem as reported here: PDF Export Huge Report We're
I have a report that I need to export to a csv file for
I have a master report with 2 subreports. I use the same report to
I have a report generation functionality. Export to csv or txt . For each
I have a report viewer that I am using to export to PDF and
I have a report in which I want to display value of 2 engineers
I have a report generated in Gridview and I want to save the report
I have a webapp that export reports in PDF. Everything is fine when the

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.