Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

French text display problem in JASPER report docs

Posted on 2007-11-14
10
Medium Priority
?
2,545 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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Introduction This tutorial provides instructions on how to properly format your Word document using the inbuilt tools provided. The benefits of using these tools means your documents are more accessible and easily portable to other applications an…
Microsoft Word is a program we have all encountered at some point, but very few of us have dug deep into its full scope of features, let alone customized it to suit our needs. Luckily making the ribbon (aka toolbar, first introduced in Word 2007) wo…
This video shows where to find templates, what they are used for, and how to create and save a custom template using Microsoft Word.
Learn how to make your own table of contents in Microsoft Word using paragraph styles and the automatic table of contents tool. We'll be using the paragraph styles in Word’s Home toolbar to help you create a table of contents. Type out your initial …
Suggested Courses
Course of the Month9 days, 13 hours left to enroll

926 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