Solved

French text display problem in JASPER report docs

Posted on 2007-11-14
10
2,500 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Portable, direct connect server access

The ATEN CV211 connects a laptop directly to any server allowing you instant access to perform data maintenance and local operations, for quick troubleshooting, updating, service and repair.

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

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

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

Nice table. Huge mess. Maybe this was something you created way back before you figured out tabs or a document you received from someone else. Either way, using the spacebar to separate the columns resulted in a mess. Trying to convert text to t…
You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
This video teaches the viewer how to align pictures around text while keeping the text properly aligned in the document.
This video shows and describes the main difference between both orientations in Microsoft Word. Viewers will understand when to use each orientation and how to get the most out of them.

751 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