Summary of the invention
Technical matters to be solved by this invention is at the deficiencies in the prior art, provides a kind of report customization based on graphical mapping relations to generate method automatically.
Technical scheme of the present invention is as follows:
A kind of report customization based on graphical mapping relations generates method automatically, wherein, may further comprise the steps:
Step 1: carry out template and draw;
Step 2: the mapping relations of setting up visual edit test data and report form template;
Step 3: report generation;
Step 4: check described form whether to satisfy customized demand, as satisfy customized demand, then export and/or print; Then judge whether to revise into the template needs as not satisfying customized demand, return step 1 in this way, as otherwise judge whether then to return step 2 in this way for mapping relations need to revise, as otherwise finish.
Described report customization generates method automatically, wherein, and the concrete following steps of carrying out of described step 1:
Step 101: newly-built or open the template file of a sky;
Step 102: draw template file;
Step 103: whether template file satisfies customized demand; Then save as new template file after the name in this way, otherwise return step 102.
Described report customization generates method automatically, wherein, draws template described in the described step 102 for adding the title of form, modification table style, interpolation row, column.
Described report customization generates method automatically, and wherein, the mapping relations in the described step 2 are for adopting the mode of format organization's mapping relations of tabulating, and each mapping relations has comprised the predetermined information of mapping relations corresponding to a list items in the list items; Described predetermined information is threshold values and the font color of test data, filling value, filling type, test data.
Described report customization generates method automatically, and wherein, the mapping relations in the described step 2 comprise filling information and the set of mapping relations item; Described filling information is made up of template file type, template file pathname, file destination pathname; The set of described mapping relations item, the set of being formed by the mapping relations item; Described mapping relations item comprises: positional information, padding data, filling type, the threshold information of test related data in table; The positional information of described test related data in table number is made up of table index number, line index number, column index; Described padding data is Word message or data message; Described numerical information is the data type of single-point value, one-dimension array, two-dimensional array; Described filling type is that data are filled into the mode in the template file, is divided into single cell, single file, single-row, multiple lines and multiple rows, does not advance form etc.Described threshold information is that the threshold values of test data is judged, according to judged result, and the color of font when self-defined test data is advanced form.
Described report customization generates method automatically, wherein, and the concrete following steps of carrying out of described step 3:
Step 301: load data source, obtain data list;
Step 302: resolve the template file path, obtain the template file object;
Step 303: carry out the mapping relations item successively;
Step 304: obtain padding data, fill area, filling type by the data object in the mapping relations, finish corresponding filling;
Step 305: judge that whether mapping relations are last in the set, then generate the file destination form in this way; As otherwise return step 303.
Described report customization generates method automatically, wherein, and the concrete following steps of carrying out of described step 304:
Step 3041: for single cell, padding data is single value, when the thresholding setting enables, padding data and thresholding is compared, and in the time of in being in thresholding, arranging and filling font color is default color, otherwise is the color that transfinites; The padding data of designated color is write zone to be filled; When thresholding does not enable, directly padding data is write zone to be filled;
Step 3042: filling corresponding padding data for single file is one-dimension array, and at first first padding data writes zone to be filled; The next item down of padding data is filled into the right-hand cell of previous step; Carry out successively and laterally fill a widthwise size cell;
Step 3043: to fill corresponding padding data be one-dimension array for single-row, and first of padding data write zone to be filled; The next item down of padding data is filled into the below cell of previous step; Carry out successively and vertically fill a vertically size cell;
Step 3044: fill for multiple lines and multiple rows, corresponding data are two-dimensional array, press a single file filling widthwise size cell, and the single file that circulates is successively filled, and filling vertically size is gone until end.
A kind of report customization automatically generating device based on graphical mapping relations wherein, comprises that report form template is drawn display module, graphical mapping relations editing machine and the report generation module interconnects and communication mutually; Described report form template is drawn display module, is used for providing template to draw and report display, and provide that general-purpose interface is drawn, demonstration and printing reports; Described graphical mapping relations editing machine is used for providing the mapping relations of visual edit test data and report form template, the filling mode when test data enters form; Described report generation module is used for realizing that data source to the filling of form, realizes output and the printing of form by the interface of form drafting module.
The present invention adopts by report form template and draws the scheme that display module is drawn, and does not need to prepare the data source with the formwork structure coupling, thereby has saved the plenty of time; Graphical mapping relations editing machine provides visual way to set up mapping relations for general data source and template, brings the more intuitive effect of user and stronger operability, the filling mode when can also visual modification data entering form.The test operation personnel can reduce operating personnel's requirement by revising graphical mapping relations, have saved cost of development; By the visual operation of report generation module, real-time checks template style and mapping relations, in time they is made amendment, and improves development efficiency; By the judgement of threshold values is provided, can also verify the test data correctness.
Embodiment
Below in conjunction with the drawings and specific embodiments, the present invention is described in detail.
Embodiment 1
As Figure 1-3, based on the automatic generation technique of the report customization of graphical mapping relations, be divided into report form template and draw display module, graphical mapping relations editing machine, report generation module three parts.Report form template is drawn display module provides template to draw function and report display function, and provides general-purpose interface to draw and demonstration, printing reports; Graphical mapping relations editing machine is the test operation personnel, and the mapping relations of visual edit test data and report form template, the filling mode when test data enters form are provided; The report generation execution module realizes that data source to the filling of form, realizes output and the printing of form by the interface of form drafting module.
The cooperation relation of three parts: at first move report form template drafting display module and come editing template, move the corresponding relation of data and template position in the graphical mapping relations editing machine editing data source then, move report generation module production report at last, whether relatively generate form consistent with customized demand, revise template when inconsistent or revise mapping relations, whether move the report generation module then, it is consistent with customized demand relatively to generate the target form again; Finish when consistent.
It is manually to set up report form template that report form template is drawn display module, and idiographic flow as shown in Figure 2.The template file step 101 of an at first newly-built sky is utilized drawing tool, draws template, adds the title step 102 of form, modification table style, interpolation row, column, with demand contrast step 103, when satisfying the demands fully, saves as new template.
Graphical mapping relations editing machine at first adopts by patterned mode and sets up data in the data source and the mapping relations of report form template.Can adopt format organization's mapping relations of tabulation, each mapping relations has comprised all information that mapping relations are required corresponding to a list items in the list items, comprises threshold values, color of test related data, filling value, test data etc.The graphical basic operation of mapping relations editing machine is divided into interpolation, deletes, empties, on move, move down etc., use these easy to operate mapping relations of setting up fast.
Mapping relations, gather two parts by filling information and mapping relations item: wherein filling information is by template file type, template file pathname, file destination pathname etc., and the filling information structural design is as shown in table 1 below:
Mapping relations item set, by the set that the mapping relations item is formed, wherein the mapping relations item comprises: the positional information of test related data in table, padding data, filling type, threshold information etc.The positional information of test related data in table number is made of table index number, line index number, column index.Padding data can be Word message, also can be numerical information etc., and numerical information provides the support of the data type of single-point value, one-dimension array, two-dimensional array.Filling type is that data are filled into the mode in the template file, is divided into single cell, single file, single-row, multiple lines and multiple rows, does not advance form etc.Mapping relations item structural design is as shown in table 2 below:
Threshold information provides the threshold values of test data to judge, according to judged result, and the color of font when can self-defined test data advancing form.Structural design is as shown in table 3 below:
Report generation visual operational mode and the operation provide form to fill is provided, is stopped, pausing operation.It is that the first step obtains data source object step 301 in test macro that flow process is carried out in report generation; Second step was opened template file, obtained the table objects step 302 in the template file; The 3rd step was carried out mapping relations successively, number constituted positional information by the table number in the mapping relations, row number, row, obtained regional step 303 to be filled in table objects; Obtain padding data by the data object in the mapping relations; Filled in different ways by the filling in the mapping relations: 1) for single cell, padding data is single value, when the thresholding setting enables, padding data and thresholding are compared, when in thresholding, arranging and filling font color is default color, otherwise is the color that transfinites, and the padding data of designated color is write zone to be filled; When thresholding does not enable, directly padding data is write zone to be filled; 2) filling corresponding padding data for single file is one-dimension array, and at first first padding data writes zone to be filled; The next item down of padding data is filled into the right-hand cell of previous step; Carry out successively and laterally fill an X-direction size cell.3) be one-dimension array for single-row padding data of filling correspondence.First padding data writes zone to be filled; The next item down of padding data is filled into the below cell of previous step; Carry out successively and vertically fill a Y-direction size cell.4) fill for multiple lines and multiple rows, corresponding data are two-dimensional array.Press single file and fill an X-direction size cell, the single file that circulates is successively filled, and fills Y-direction size row and finishes.The 4th step circulated for the 3rd step successively, all write all padding datas in the tabulation in the form; The 5th step table objects saves as file destination, perhaps directly opens or printout.
Embodiment 2
On the basis of above-described embodiment, as shown in Figure 1: provide a kind of report customization based on graphical mapping relations to generate method automatically, wherein, may further comprise the steps:
Step 1: carry out template and draw;
Step 2: the mapping relations of setting up visual edit test data and report form template;
Step 3: report generation;
Step 4: checking described form whether to satisfy customized demand, is then to export and/or print; Otherwise enter step 5;
Step 5: continue to judge whether to be then to return step 1, otherwise to enter step 6 for template needs to revise;
Step 6: continue to judge whether for mapping relations need to revise, as then returning step 2, otherwise finish.
Described report customization generates method automatically, wherein as shown in Figure 2, and the concrete following steps of carrying out of described step 1:
Step 101: newly-built or open the template file of a sky;
Step 102: draw template file;
Step 103: whether template file satisfies customized demand; Then save as new template file after the name in this way, otherwise return step 102.
Described report customization generates method automatically, wherein, draws template described in the described step 102 for adding the title of form, modification table style, interpolation row, column.
Described report customization generates method automatically, and wherein, the mapping relations in the described step 2 are for adopting the mode of format organization's mapping relations of tabulating, and each mapping relations has comprised the predetermined information of mapping relations corresponding to a list items in the list items; Described predetermined information is threshold values and the font color of test data, filling value, filling type, test data.
Described report customization generates method automatically, and wherein, the mapping relations in the described step 2 comprise filling information and the set of mapping relations item; Described filling information is made up of template file type, template file pathname, file destination pathname; The set of described mapping relations item, the set of being formed by the mapping relations item; Described mapping relations item comprises: positional information, padding data, filling type, the threshold information of test related data in table; The positional information of described test related data in table number is made up of table index number, line index number, column index; Described padding data is Word message or data message; Described numerical information is the data type of single-point value, one-dimension array, two-dimensional array; Described filling type is that data are filled into the mode in the template file, is divided into single cell, single file, single-row, multiple lines and multiple rows, does not advance form etc.Described threshold information is that the threshold values of test data is judged, according to judged result, and the color of font when self-defined test data is advanced form.
Described report customization generates method automatically, wherein as shown in Figure 3, and the concrete following steps of carrying out of described step 3:
Step 301: load data source, obtain data list;
Step 302: resolve the template file path, obtain the template file object;
Step 303: carry out the mapping relations item successively;
Step 304: obtain padding data, fill area, filling type by the data object in the mapping relations, finish corresponding filling;
Step 305: judge that whether mapping relations are last in the set, then generate the file destination form in this way; As otherwise return step 303.
Described report customization generates method automatically, wherein, and the concrete following steps of carrying out of described step 304:
Step 3041: for single cell, padding data is single value, when the thresholding setting enables, padding data and thresholding is compared, and in the time of in being in thresholding, arranging and filling font color is default color, otherwise is the color that transfinites; The padding data of designated color is write zone to be filled; When thresholding does not enable, directly padding data is write zone to be filled;
Step 3042: filling corresponding padding data for single file is one-dimension array, and at first first padding data writes zone to be filled; The next item down of padding data is filled into the right-hand cell of previous step; Carry out successively and laterally fill a widthwise size cell;
Step 3043: to fill corresponding padding data be one-dimension array for single-row, and first of padding data write zone to be filled; The next item down of padding data is filled into the below cell of previous step; Carry out successively and vertically fill a vertically size cell;
Step 3044: fill for multiple lines and multiple rows, corresponding data are two-dimensional array, press a single file filling widthwise size cell, and the single file that circulates is successively filled, and filling vertically size is gone until end.
Embodiment 3
On the basis of above-described embodiment, a kind of report customization automatically generating device based on graphical mapping relations is provided, wherein, comprise that report form template is drawn display module, graphical mapping relations editing machine and the report generation module interconnects and communication mutually; Described report form template is drawn display module, is used for providing template to draw and report display, and provide that general-purpose interface is drawn, demonstration and printing reports; Described graphical mapping relations editing machine is used for providing the mapping relations of visual edit test data and report form template, the filling mode when test data enters form; Described report generation module is used for realizing that data source to the filling of form, realizes output and the printing of form by the interface of form drafting module.
Method and step that each module in the said apparatus interconnects and mutually uses among communication implementation and method and the embodiment 2 are identical, and the flow process of concrete grammar realization does not repeat them here shown in content among Fig. 1-Fig. 3 and the embodiment 2.
Should be understood that, for those of ordinary skills, can be improved according to the above description or conversion, and all these improvement and conversion all should belong to the protection domain of claims of the present invention.