Solved

French text display problem in JASPER report docs

Posted on 2007-11-14
10
2,486 Views
Last Modified: 2012-06-27
Please help me regarding this problem

I use jasper report for report in my web project (Tomcat). I am saving the report in .rtf file and from java. Also, I read the text from iReport (jasper tool) and write it in the .doc/.rtf documents.

When the tomcat is in windows OS, the french texts in the .rtf report is displayed as well.

But If the tomcat is in Linux OS, the same french text is displayed with some changes

The Code for saving the report as .rtf
=======================================

JasperPrint jasperPrint = JasperManager.fillReport(jasperReport,parameters,c onn);
JRRtfExporter rtfExporter = new JRRtfExporter(); rtfExporter.setParameter(JRExporterParameter.JASPE R_PRINT, jasperPrint); rtfExporter.setParameter(JRExporterParameter.OUTPU T_FILE_NAME,
request.getRealPath("includes")+"/report.rtf");
rtfExporter.exportReport();



So now the report is saved as report.doc

And I read the document and display it. For that code is
================================================== ======

response.setHeader ("Content-Disposition", "attachment;filename="Report.rtf"");
File f = new File("report.doc");
InputStream in = new FileInputStream(f);
ServletOutputStream outs = response.getOutputStream();
int bit = 256;
int i = 0;
try {
while ((bit) >= 0) {
bit = in.read();
outs.write(bit);
}
} catch (IOException ioe) {
ioe.printStackTrace(System.out);
}
outs.flush();
outs.close();
in.close();

*****************************************


1) Do I need to map any font while i create doc/rtf reports? because in windows it is not a problem...

2) Accent problem is the main one in this .rtf/doc...how to overcome this when we create report?


0
Comment
Question by:Loganathan Natarajan
  • 5
  • 4
10 Comments
 
LVL 35

Expert Comment

by:TimYates
ID: 20278560
If you open the PDF directly, rather than through the servlet, does it look ok then?

ie:  Is it a generation problem, or a transmission problem?
0
 
LVL 36

Author Comment

by:Loganathan Natarajan
ID: 20278584
i think it is transmission problem... because in normal word document also when i write french text.. it is not displaying correctly..  

do we need to apply french fonts to display the french text in word doc???

but it works well in pdf docs..
0
 
LVL 35

Expert Comment

by:TimYates
ID: 20278622
Are you viewing the file on the two different OSes as well?

I'm confused now...

So this works:

    GENERATE(windows) -> SERVLET(windows) -> VIEW(windows)

Does this?

    GENERATE(windows) -> SERVLET(windows) -> VIEW(linux)

Or are you saying that this doesn't work:

    GENERATE(linux) -> SERVLET(linux) -> VIEW(windows)

?
0
 
LVL 36

Author Comment

by:Loganathan Natarajan
ID: 20278632
my development OS is in windows... the deployment (upload) OS is in linux.. so.. as for windows everything works fine...


So this works:

 GENERATE(windows) -> SERVLET(windows) -> VIEW(windows)
0
 
LVL 35

Expert Comment

by:TimYates
ID: 20278665
And this:

GENERATE(linux) -> SERVLET(linux) -> VIEW(windows)

fails?
0
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
LVL 5

Expert Comment

by:deeppra
ID: 20278733
try to save the file in unicode encoding format
0
 
LVL 36

Author Comment

by:Loganathan Natarajan
ID: 20278915
i tried using unicode encoding as well as the below way also,
rtfExporter.setParameter(JRExporterParameter.OUTPUT_STREAM, response.getOutputStream());

it doesn't works....


do i need apply any french font while i create the doc/rtf ?

0
 
LVL 35

Accepted Solution

by:
TimYates earned 500 total points
ID: 20278958
RTFs don't have embedded fonts as far as I know

It is more than likely an encoding issue somewhere in your pipeline...  Either the generation of the RTF or the sending it to the user phase

That's why I asked if you can copy the RTF off of the Linux box onto your Windows box using normal tools, and open it that way...  Is it the actual RTF file which is corrupted?  

I guess that the RTF is fine when generated on the Linux box, but it is the servlet that is mis-handling it
0
 
LVL 36

Author Comment

by:Loganathan Natarajan
ID: 20278974
ok...RTF formats works well..but designs are not applied properly... only TEXT's could be displayed...

so i have to go for .doc formate... how do i solve it in .doc format?
0
 
LVL 36

Author Comment

by:Loganathan Natarajan
ID: 20286313
anymore comments?
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Apache,  not running php on top level 14 59
Re-indent word doc 5 41
Convert .PDF 6 60
add more styles to my code 2 46
I would like to show you some basics you can do with Mailings in MS Word. It´s quite handy feature you can use for creating envelopes, labels, personalized letters etc. First question could be what is this feature good for? Mailing can really he…
A few years ago I was very much a beginner at VBA, and that very much remains the case today.  I'll do my best to explain things as I go in the hope that other beginners can follow.  If you just want to check out a tool that creates a Select Case fu…
This video shows the viewer how to set up and create Footnotes in their document. Click on the References tab: Select "Insert Footnote": Type in desired text:
In a previous video Micro Tutorial here at Experts Exchange (http://www.experts-exchange.com/videos/1358/How-to-get-a-free-trial-of-Office-365-with-the-Office-2016-desktop-applications.html), I explained how to get a free, one-month trial of Office …

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now