Jump to content

Can't export IReport 5.0 to Excel Only


jgoddard

Recommended Posts

Hi,

 

I'm new to Ireport and I have a report that I am trying to export to Excel.  It exports to pdf. fine, and even exported to excel until I added the following code in the expression editor of a field.

 

$F{test_name}.equals("Install / Up / Down")  ?
$F{testresult_resulttext}  :
$F{test_name}.equals("Order Date")  ?
$F{testresult_resultdate}  :
("")

 

When I run it I get the following error:

Error Message

java.lang.ClassCastException: java.lang.String cannot be cast to java.util.Date

 

Anybody else encounter something similar?  Thanks in advance!

 

Link to comment
Share on other sites

  • Replies 3
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Thanks- I found another workaround- I edited my code as below and it gave me the output needed.

 

$F{test_name}.equals("Install / Up / Down") ?

$F{testresult_resulttext} :

$F{test_name}.equals("Order Date") ?

new SimpleDateFormat("dd MMM yyyy").format($F{testresult_resultdate})

:

("")

Link to comment
Share on other sites

Apologies, I didn't mean to post the comment on your response.  Anyhow, thanks for the clarification.  I found a workaround that gave me the output needed in excel- it is below.

 

$F{test_name}.equals("Install / Up / Down") ?
$F{testresult_resulttext} :
$F{test_name}.equals("Order Date") ?
new SimpleDateFormat("dd MMM yyyy").format($F{testresult_resultdate})
:
("")

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...