provide-free-support Ujjwal's Blog: Block characters in excel sheet using jxl api java

Thursday, October 28, 2010

Block characters in excel sheet using jxl api java

Hi,

Today one of my project which was getting used in Serbia started giving a problem, users started complaining that they are getting square block characters between text. Now, this problem was due to different character-set which was handled upto a certain extent when i initially developed this project. I tried all sorts of things to handle this issue and finally i came up with a solution below :

 if(myText!=null)
 {
 label = new Label(0, a, "Header", cellFormat1);
 sheet5.addCell(label);


a=a+1;  

                                                
if(myText.substring(myText.length()-1, myText.length()).equals("\n"))
{
                                                   
 label = new Label(0, 1, myText.replace('\r',' ').replaceAll("[^\\p{ASCII}]",""), myCellFormat);
 sheet5.addCell(label);


}//end of sub-if
//end of main-if








//end of code


************here's the explanation for the code*********

1) [^\\p{ASCII}]

This says "replace all occurences of one or more non-ASCII characters with nothing." So the new string will be the old string minus all non-ASCII characters. You just check the new String's length.

Or you could just iterate over the string, checking if each char is between 0x00 and 0x7F.





2) '\r'
This was for removing carriage returns which were getting displayed in my excel sheet as block characters   

Finally, at the end of my day, this issue got resolved and for multiple countries this issue got resolved.

Regards,

Ujjwal Soni                                                                                              

No comments:

best-it-exam-    | for-our-work-    | hottst-on-sale-    | it-sale-    | tast-dumps-us-    | test-king-number-    | pass-do-it-    | just-do-it-    | pass-with-us-    | passresults-everything-    | passtutor-our-dumps-    | realtests-us-exam-    | latest-update-source-for-    | cbtnuggets-sale-exam    | experts-revised-exam    | certguide-sale-exam    | test4-sale-exam    | get-well-prepared-    | certkiller-sale-exam    | buy-discount-dumps    | how-to-get-prepared-for-the    | in-an-easy-way    | brain-dumps-sale    | with-pass-exam-guarantee    | accurate-study-material    | at-first-try    | 100%-successful-rate    | get-certification-easily    | material-provider-exam    | real-exam-practice    | with-pass-score-guarantee    | certification-material-provider    | for-certification-professionals    | get-your-certification-successfully    | 100%-Pass-Rate    | in-pdf-file    | practice-exam-for    | it-study-guides    | study-material-sku    | study-guide-pdf    | prep-guide-demo    | certification-material-id    | actual-tests-demo    | brain-demos-test    | best-pdf-download    | our-certification-material    | best-practice-test    | leading-provider-on    | this-course-is-about    | the-most-reliable    | high-pass-rate-of    | high-pass-rate-demo    | recenty-updated-key    | only-for-students-free-download    | courseware-plus-kit-for    | accurate-answers-of    | the-most-reliable-id    | provide-training-for    | welcome-to-buy    | material-for-success-pass    | provide-free-support    | best-book-for-pass    | accuracy-of-the-answers    | pass-guarantee-id    | pass-exam-key    | pass-sku-id    | study-for-exid    | pdf-sku-exid    | sku-pdf-id    | pdf-demo-key    | exam-demo-ske    | pass-it-dump    |
http://www.menuiserie-dauvergne.com/    | http://www.menuiserie-dauvergne.com/    |