Page 4 of 7

Re: the problem of the Chinese code

Posted: Fri Jun 03, 2016 5:49 am
by Vadim
Hello.
Can you send us .mrt file with this wrong symbols in datasource ?

Re: the problem of the Chinese code

Posted: Sat Jun 04, 2016 2:46 am
by heqichao

Re: the problem of the Chinese code

Posted: Mon Jun 06, 2016 6:01 am
by Vadim
Hello.
This name is broken, You should reenter chinese names again & save file.

Re: the problem of the Chinese code

Posted: Tue Jun 07, 2016 2:58 am
by heqichao
hello, I don't know what's your mean, when I save the report the name is broken.

Re: the problem of the Chinese code

Posted: Tue Jun 07, 2016 11:40 am
by Vadim
Hello.
We tried your report - words broken and then we reenter chinese characters and save. Then no broken characters in report.

Re: the problem of the Chinese code

Posted: Wed Jun 08, 2016 1:59 am
by heqichao
Hello,there are broken characters but I just create the mysql connection ,and I don't know how are you create dataSource.
Image
Image

Re: the problem of the Chinese code

Posted: Wed Jun 08, 2016 2:00 am
by heqichao
Hello , and what about this problem?
heqichao wrote:Hello, it is a problem about Chinese disorder code.
I use json dataSource and the data is this,
Image

but the Chinese Disorder Code in the report.
Image

it is my report .Thank you.
http://test.arp.cn/appendix/M00/00/1A/C ... IN_RPT.mdc

Re: the problem of the Chinese code

Posted: Wed Jun 08, 2016 11:33 am
by Vadim
Hello.
As we see mdc file have wrong data
<item45 Ref="47" bh="Transparent" br="All;Black;1;Solid;False;4;Black" fn="MICROSOFT YAHEI UI,10" ha="Center" isSer="true" mr="0,0,0,0" name="Text54" pl="d.DataBand4" rc="2.4,5,3.8,1" tb="Black" text="转��方预算负责人审批" type="Text" va="Center" />
can you send us .mrt file with data

Re: the problem of the Chinese code

Posted: Sun Jun 12, 2016 9:05 am
by heqichao
Hello ,this is my code

Code: Select all

public static StiReport getReport(String reportPath,String httpQueryUrl){
			 StiReport stiReport = null;
			 try {
				 stiReport = StiSerializeManager.deserializeReport(new File(reportPath));
			     stiReport.getDictionary().getDataSources().clear();
			     stiReport.getDictionary().getDatabases().clear();
				 stiReport.getDictionary().getRelations().clear();
				 StiJsonDatabase db = null;
				 if(stiReport.getDictionary().getDatabases().get("JSON")== null){
					  db = new StiJsonDatabase("JSON",httpQueryUrl);
	            	  stiReport.getDictionary().getDatabases().add(db);
				 }else{
					 db=(StiJsonDatabase) stiReport.getDictionary().getDatabases().get("JSON");
				 }
            	
	              JSONObject resuleObj =db.getJSONObject();
	              //TODO
	              JSONObject obj =resuleObj.getJSONObject("obj");
	              for(String ojbKey : obj.getNames(obj)){
	            	   JSONArray list =(JSONArray) obj.get(ojbKey);
	            	   StiDataTableSource ts = new StiDataTableSource("JSON"+"."+ojbKey, ojbKey, ojbKey);
			           ts.setColumns(new StiDataColumnsCollection());
				       Map keyMap =ReportUtil.getJsonArrayKey(list, new HashMap());
				        for(Object key :keyMap.keySet()){
				        	 ts.getColumns().add(new StiDataColumn((String)key, (String)key, StiSystemTypeEnum.SystemString.getSystemType()));
				        }
				        ts.setDictionary(stiReport.getDictionary());
				        stiReport.getDictionary().getDataSources().add(ts); 
	              }
              } catch (Exception e) {
					e.printStackTrace();
			}
	        stiReport.Render(false);
	        return stiReport;
		}


public static Map getJsonArrayKey(Object obj,Map keyMap){
			if(obj instanceof JSONArray){
				JSONArray jsonArray =(JSONArray) obj;
				int length = jsonArray.length();
				for(int i=0;i<length;i++){
					try {
						JSONObject jsonObject =jsonArray.getJSONObject(i);
						String[] names=JSONObject.getNames(jsonObject);
						for(String name :names){
							keyMap.put(name, name);
						}
					} catch (JSONException e) {
						// TODO Auto-generated catch block
						e.printStackTrace();
					}
				}
			}
			else if(obj instanceof JSONObject){
				JSONObject jsonObject =(JSONObject) obj;
				String[] keys=JSONObject.getNames(jsonObject);
				for(String key : keys){
					try {
						if(jsonObject.get(key) instanceof JSONArray){
							getJsonArrayKey(jsonObject.get(key), keyMap);
						}
					} catch (JSONException e) {
						// TODO Auto-generated catch block
						e.printStackTrace();
					}
				}
			}
			return keyMap;
		}



and is my report and the json data :
http://test.arp.cn/appendix/M00/00/1B/C ... IN_RPT.mrt
http://test.arp.cn/appendix/M00/00/1B/C ... =json.json

and this my http request
Image

Re: the problem of the Chinese code

Posted: Mon Jun 13, 2016 6:14 am
by Alex K.
Hello,

We need some additional time for investigating the issue.
We will try to add the additional changes within two or three weeks.

We will let you know about the result.
Thank you.