Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

display of japanese characters in Excel report

 
Shobha Korrapati
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Amol Nayak
Ranch Hand
Posts: 218
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you sending the generated excel sheet as an attachment?
 
Jaikiran Pai
Marshal
Pie
Posts: 10447
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"Shobha"

Welcome to JavaRanch

Please check your private message, for a message from JavaRanch.
 
Shobha Korrapati
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yes i am sending the generated excel sheet as an attachment
 
Amol Nayak
Ranch Hand
Posts: 218
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Rancher
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic