Exporting Jasper report to Text File

0

Hello Every one,

                               I want  to export Jasper report to Text file instead of PDF file, for this I am using JRTextExporter API. for reports having no textfields its work fine, but I have a report that have multiple textfields when I tried to convert that Report thet give me ArrayOutOfBound Exception. any please help me.

in the attachment I have uploaded Jrxml file of my report

 

the stack trace is given:

java.lang.ArrayIndexOutOfBoundsException
java.lang.ArrayIndexOutOfBoundsException
    at java.lang.System.arraycopy(Native Method)
    at net.sf.jasperreports.engine.export.JRTextExporter.exportText(JRTextExporter.java:615)
    at net.sf.jasperreports.engine.export.JRTextExporter.exportElements(JRTextExporter.java:393)
    at net.sf.jasperreports.engine.export.JRTextExporter.exportPage(JRTextExporter.java:370)
    at net.sf.jasperreports.engine.export.JRTextExporter.exportReportToWriter(JRTextExporter.java:346)
    at net.sf.jasperreports.engine.export.JRTextExporter.exportReport(JRTextExporter.java:222)
    at com.example.reporttextexporter.ReporttextexporterApplication.make(ReporttextexporterApplication.java:156)
    at com.example.reporttextexporter.ReporttextexporterApplication.access$0(ReporttextexporterApplication.java:128)
    at com.example.reporttextexporter.ReporttextexporterApplication$1.buttonClick(ReporttextexporterApplication.java:49)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at com.vaadin.event.ListenerMethod.receiveEvent(ListenerMethod.java:512)
    at com.vaadin.event.EventRouter.fireEvent(EventRouter.java:164)
    at com.vaadin.ui.AbstractComponent.fireEvent(AbstractComponent.java:1219)
    at com.vaadin.ui.Button.fireClick(Button.java:550)
    at com.vaadin.ui.Button.changeVariables(Button.java:217)
    at com.vaadin.terminal.gwt.server.AbstractCommunicationManager.changeVariables(AbstractCommunicationManager.java:1451)
    at com.vaadin.terminal.gwt.server.AbstractCommunicationManager.handleVariableBurst(AbstractCommunicationManager.java:1399)
    at com.vaadin.terminal.gwt.server.AbstractCommunicationManager.handleVariables(AbstractCommunicationManager.java:1318)
    at com.vaadin.terminal.gwt.server.AbstractCommunicationManager.doHandleUidlRequest(AbstractCommunicationManager.java:763)
    at com.vaadin.terminal.gwt.server.CommunicationManager.handleUidlRequest(CommunicationManager.java:296)
    at com.vaadin.terminal.gwt.server.AbstractApplicationServlet.service(AbstractApplicationServlet.java:501)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:224)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:169)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
    at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:927)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
    at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:987)
    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:579)
    at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:309)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)

Attachments: 
salmankhans87's picture
Joined: Jul 22 2013 - 11:42pm
Last seen: 6 years 4 weeks ago

3 Answers:

0

Hi salmankhans87,

I could not export a report to txt.
Try to export to CSV file instead.
It is just as the same as a text file.

Let me know if this helps.

Kind regards,

Paulo

 

pssp25's picture
-3
Joined: Feb 28 2013 - 6:58am
Last seen: 6 years 3 weeks ago
0

Thanks for your reply paulo

first of all let me tell you that I successfully exported some reports to txt. but the problem occures in the above mentioned report that causes exception.

second thing is that it is one of the requirement of my client, so I have to fullfill my client requirent and they need text file not CSV file.

so please if you or some one else can help me.

regards,

Salman Khan

salmankhans87's picture
Joined: Jul 22 2013 - 11:42pm
Last seen: 6 years 4 weeks ago
0

you can write your resultset in text file and save that file as ".txt", no need any report tool for that.

rahul.mukinda's picture
Joined: Jul 25 2013 - 4:31am
Last seen: 6 years 4 weeks ago
Feedback
randomness