svi Posted May 3, 2012 Share Posted May 3, 2012 Hi, I work on a report that uses a XLS file for data-source, from which I export the content to a PDF.Some cells of my XLS contains some 'é' or some 'ç', and those char are not correctly retrieved. For instance, "Message écrit reçu" becomes "Message crit mis". I tried to change de encoding of my text fields in my reports, but the problem seems to be the encoding of my source XLS. However, I tried to save the XLS with other encoding options, but the result was pretty much the same.I made a variable in order to get the charAt() value of these char, and 'é' gives me 65533. Any ideas ? Thanks :) Link to comment Share on other sites More sharing options...
svi Posted May 4, 2012 Author Share Posted May 4, 2012 I found the solution, so here it is, for those who face the same issue.Here is how I was loading my Datasource : JRXlsDataSource ds = new JRXlsDataSource(TestXls.class.getResourceAsStream("fake_d3.xls")); But apparently, JXL assumes that your input file is encoded in UTF-8. So I changed my code for this : WorkbookSettings ws = new WorkbookSettings(); ws.setEncoding("CP1250"); Workbook wb = Workbook.getWorkbook(TestXls.class.getResourceAsStream("fake_d3.xls"), ws); JRXlsDataSource ds = new JRXlsDataSource(wb); This works fine. I hope it will help someone else ! Link to comment Share on other sites More sharing options...
andrefellows Posted June 6, 2012 Share Posted June 6, 2012 Man, you save my day! I was getting mad about this! Thanx a LOT! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now