jasper reports - JasperViewer does not print unicode characters in Windows -
not sure why jasperviewer not print unicode characters in windows. tried install bengali fonts did not work.
i retrieving data mysql , in report replacing numbers bengali unicode numbers. works fine in linux (debian). when run application jar file in windows (10), font broken. nothing displayed except table.
what doing wrong?
it harder today format xml code here! pasted on http://pastebin.com/xc3eizyf
java method:
public void clickbutton(actionevent event) throws classnotfoundexception, unsupportedlookandfeelexception, instantiationexception, illegalaccessexception, jrexception, sqlexception { //system.out.println(dir); string date = viewreport.gettext(); string reportsrcfile = "/home/famed/ideaprojects/salary sheet/src/salarysheet/salary2.jrxml"; jasperreport report = jaspercompilemanager.compilereport(new file("").getabsolutepath()+"/rtemp/salary2.jrxml"); system.out.println(report.tostring()); connection conn = sqlconnect.con(); // parameters report map<string, object> parameters = new hashmap<string, object>(); parameters.put("repdate", viewreport.gettext()); if(displaydate.gettext().isempty()){ parameters.put("displaydate",viewreport.gettext()); } else { parameters.put("displaydate",displaydate.gettext()); } system.out.println("the date:"); system.out.println(parameters.get("repdate")); jasperprint print = jasperfillmanager.fillreport(report, parameters, conn); jasperviewer jv = new jasperviewer(print); jv.setdefaultcloseoperation(jframe.exit_on_close); jv.settitle("test report"); jv.setvisible(true); }
jrxml:
<?xml version="1.0" encoding="utf-8"?> <detail> <band height="304" splittype="stretch"> <componentelement> <reportelement x="168" y="104" width="200" height="200" uuid="433fbb6e-081e-4bab-ab86-a02e4a7187c9"> <property name="com.jaspersoft.studio.layout" value="com.jaspersoft.studio.editor.layout.verticalrowlayout"/> <property name="com.jaspersoft.studio.table.style.table_header" value="table 1_th"/> <property name="com.jaspersoft.studio.table.style.column_header" value="table 1_ch"/> <property name="com.jaspersoft.studio.table.style.detail" value="table 1_td"/> </reportelement> <jr:table xmlns:jr="http://jasperreports.sourceforge.net/jasperreports/components" xsi:schemalocation="http://jasperreports.sourceforge.net/jasperreports/components http://jasperreports.sourceforge.net/xsd/components.xsd"> <datasetrun subdataset="dataset2" uuid="fd0beb84-562e-4cb7-bd56-6ff5ee927304"> <connectionexpression><![cdata[$p{report_connection}]]></connectionexpression> </datasetrun> <jr:column width="100" uuid="112d200e-48b9-473a-83c8-0d4cdc7ac60c"> <jr:columnheader style="table 1_ch" height="30"> <statictext> <reportelement x="0" y="0" width="100" height="30" uuid="8ab8f29f-6229-4abb-9754-489041715c02"/> <text><![cdata[নাম]]></text> </statictext> </jr:columnheader> <jr:columnfooter style="table 1_ch" height="30"/> <jr:detailcell style="table 1_td" height="30"> <textfield> <reportelement x="0" y="0" width="100" height="30" uuid="03c38867-008d-495f-9429-c980edcec9fa"/> <textfieldexpression><![cdata[string.valueof($f{emp_name}).replaceall("0","০").replaceall("1","১").replaceall("2","২").replaceall("3","৩").replaceall("4","৪").replaceall("5","৫").replaceall("6","৬").replaceall("7","৭").replaceall("8","৮").replaceall("9","৯")]]></textfieldexpression> </textfield> </jr:detailcell> </jr:column> <jr:column width="100" uuid="08c7b00b-bb51-4974-9f80-437a800016c0"> <jr:columnheader style="table 1_ch" height="30"> <statictext> <reportelement x="0" y="0" width="100" height="30" uuid="92539beb-73ef-4729-be59-e744fa0339fb"/> <text><![cdata[বাড়ী ভাড়া]]></text> </statictext> </jr:columnheader> <jr:columnfooter style="table 1_ch" height="30"/> <jr:detailcell style="table 1_td" height="30"> <textfield> <reportelement x="0" y="0" width="100" height="30" uuid="07286a2f-7346-40ee-aa69-4c68851020a4"/> <textfieldexpression><![cdata[string.valueof($f{home_fare_percent}).replaceall("0","০").replaceall("1","১").replaceall("2","২").replaceall("3","৩").replaceall("4","৪").replaceall("5","৫").replaceall("6","৬").replaceall("7","৭").replaceall("8","৮").replaceall("9","৯")]]></textfieldexpression> </textfield> </jr:detailcell> </jr:column> </jr:table> </componentelement> </band> </detail>
(posted on behalf of op).
i made working. forgotten change font name after adding jar files!
Comments
Post a Comment