A: Preface
In the company to learn to do the report, think this report learning is still very meaningful. Jspersonft I searched the internet for some information but not many, now is to learn a little to record a little. A good memory is better than a bad pen!
Two: Define style style in Jspersonft, the border becomes "black", Bold:
Several properties are debugged as follows: PDF encoding:unigb-ucs2-h (chinese-simplified);
PDF Font Name:stsong-light;
Font-name: Song body;
Size:12;
Padding and Borders (border): Lind width:1 (You need to select a four-azimuth border for debugging)
Three: Questions about the table data loop in Jspersonft
(1) The following steps are now step by step to explain the establishment of tabular format
1.1 as shown, first pull a table in the Component table on the right and put it in the Detail1, the result is as follows
1.2: At the bottom of the tool is the word "Main report" and Table1, click "Table1" to enter the interface as follows:
1.3: You can see "table header", "Column header", "Verbose (DETAIL1)", "Column Footer", "Table Footer", now add column header, method is in the same way, in "column header" select column 3 and then right-click "Add cell", That is, add a list header
1.4: If you want to add a cell at the end, right-click "Add Column to the end" in "Detail1", then delete "Table Header", "Column Footer", "Column 6" in "Table Footer" Such as
Remove the selected column from the graph above.
The following is the start of the table header field, and so on:
Next:
1.5: The following can be discussed how to set the table data source problem, there are two methods, one is set in the tool, and the other is set in code
(i) The first way to set up the data source in the tool:
Here is the code to query the data put into the tables of the field passed, the code is as follows:
ServletContext context =getsession (). Getservletcontext (); String FilePath=context.getrealpath ("/report/testtable.jasper"); String[] ID=getrequest (). Getparametervalues ("id")); List<Map<String,Object>> list=remandservice.getdata (ID); //The following is a fill-in is if the table data does not have 10 rows of row empty operation if(list==NULL) {List=NewArraylist<map<string,object>>(); } intcount=10; if(List.size () <=count) { for(intI=list.size (); i<10;i++) {List.add (NULL); } }Else if(List.size () >count) { intCount1= (List.size ())% 10; for(inti=count1;i<10;i++) {List.add (NULL); }} List<map<string, object>> data =NewArraylist<map<string, object>>(); Map<string, object> map =NewHashmap<string, object>(); Map.put ("Tables", list); Data.add (map);
That's all you have to say today. The operation of data binding for table in Jaspersoft. Have time to continue to write, I will first write my own paper, trouble Ah. Really do not want to write Ah, I have come out to work, or have to hand in homework, I drop a good boy. Every time you write a blog garden for Self is a review, have deepened their own knowledge of this area of the impression, efforts!!! (Finally, I am a long-winded, I still do not see the document like the API, I would like to still only stay in the stage, when to split up, do it yourself, today to download the official website, do not know is not, if some of the gods can give me a copy of the API like the document it. )
Jspersonft about table Data binding (i)