GeeCON Prague 2014*
The moose likes General Computing and the fly likes display of japanese characters in Excel report Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Engineering » General Computing
Bookmark "display of japanese characters in Excel report " Watch "display of japanese characters in Excel report " New topic
Author

display of japanese characters in Excel report

Shobha Korrapati
Greenhorn

Joined: Aug 08, 2007
Posts: 13
Hi all,

we have to diaply japanese characters in Excel reports.But they are getting displayed junk. I have tried all the ways like setting the encoding in setContentType and using setCharacterEncoding but its not working .

can anyone help me out.

Thanks in advance
Shobha


SCJP , SCWCD
Amol Nayak
Ranch Hand

Joined: Oct 26, 2006
Posts: 218
Are you sending the generated excel sheet as an attachment?
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 10146
    
165

"Shobha"

Welcome to JavaRanch

Please check your private message, for a message from JavaRanch.


[My Blog] [JavaRanch Journal]
Shobha Korrapati
Greenhorn

Joined: Aug 08, 2007
Posts: 13
yes i am sending the generated excel sheet as an attachment
Amol Nayak
Ranch Hand

Joined: Oct 26, 2006
Posts: 218
shobha said:
yes i am sending the generated excel sheet as an attachment


i think, the language of the content of the excel sheet should not
affect the content type and the there is no need to set the char encoding.

you have to do the following


response.setHeader ("Content-Disposition","attachment;filename="+filename);
where file name should be the name of the excel file generated

and

set your content type to application/octet-stream since it is a binary data,
also it can be application/x-msexcel if the file is an .xls file.

Just check your excel sheet generation code, that could be a problem.
Shobha Korrapati
Greenhorn

Joined: Aug 08, 2007
Posts: 13
I have already done as you said ...but still i am getting junk values for japanese characters ...

below is the code for excel sheet generation:

out.println("<TD>");
out.println("<font face=\"Verdana, Arial, sans-serif\" size=\"1\" color=\"#000000\">");
out.println(strOperationType);
out.println(" </B></font>");
out.println("</TD>");
out.println("<TD>");
out.println("<font face=\"Verdana, Arial, sans-serif\" size=\"1\" color=\"#000000\">");
out.println(lst.get(i++));
out.println(" </B></font>");
out.println("</TD>");
out.println("<TD>");
out.println("<font face=\"Verdana, Arial, sans-serif\" size=\"1\" color=\"#000000\">");
out.println(lst.get(i++));
out.println(" </B></font>");
out.println("</TD>");
out.println("</TR>");
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42061
    
  64
That code creates an HTML table, not an Excel file. Where does Excel enter into the picture?
[ August 08, 2007: Message edited by: Ulf Dittmer ]

Ping & DNS - my free Android networking tools app
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Originally posted by Ulf Dittmer:
That code creates an HTML table. Where does Excel enter the picture?


Excel can accept HTML tables in a text file.


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
 
GeeCON Prague 2014
 
subject: display of japanese characters in Excel report