Solved

French text display problem in JASPER report docs

Posted on 2007-11-14
10
2,491 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
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 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

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
find a specific style and pass it to a access table 4 50
Why my table column Id is not passed to java object? 4 38
login form jsp example 2 24
ejb on wildfly 5 19
If you've heard about htaccess and it sounds like it does what you want, but you're not sure how it works... well, you're in the right place. Read on. Some Basics #1. It's a file and its filename is .htaccess (yes, with a dot in the front). #…
If your site has a few sections that need to be secure when data is transmitted between the server and local computer, such as a /order/ section for ordering or /customer/ which contains customer data, etc it would of course be recommended to secure…
The viewer will learn how to make their project stand out over others by learning how to change colors and shapes, add spaces, change directions, and add bullets to their charts.
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 …

813 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

16 Experts available now in Live!

Get 1:1 Help Now