Friday, January 22, 2010

Getting square block characters when carriage return used in MS Excel 2003

Hi,

Recently i was facing a strange issue with JXL API for excel sheet generation using JAVA, the data entry screen was fine but when i was generating reports, i got some strange characters at each carriage return. This issue only happened in MS Excel 2003, this worked fine in other office versions.

Actually this issue only appeared in some European countries, worked fine in Asia.

So, i tried replaceAll method to replace this character with blank spaces like this ::

reportValue.replaceAll("[\\r\\n]", "");

This worked fine but it removed all my carriage returns too..

So, i tried below code which removed that square block character and restored my keystrokes.

reportValue..replace('\r',' ').replace('\'',' ');

This worked absolutely fine in All office versions and all countries for both europe and asia.

Cheers,

Ujjwal Soni

No comments: