CN106407172B - A kind of report form generation method based on XML - Google Patents

A kind of report form generation method based on XML Download PDF

Info

Publication number
CN106407172B
CN106407172B CN201611019782.9A CN201611019782A CN106407172B CN 106407172 B CN106407172 B CN 106407172B CN 201611019782 A CN201611019782 A CN 201611019782A CN 106407172 B CN106407172 B CN 106407172B
Authority
CN
China
Prior art keywords
report
file
xml
css
data file
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201611019782.9A
Other languages
Chinese (zh)
Other versions
CN106407172A (en
Inventor
袁国彬
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
TD Tech Ltd
Original Assignee
TD Tech Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by TD Tech Ltd filed Critical TD Tech Ltd
Priority to CN201611019782.9A priority Critical patent/CN106407172B/en
Publication of CN106407172A publication Critical patent/CN106407172A/en
Application granted granted Critical
Publication of CN106407172B publication Critical patent/CN106407172B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/10Text processing
    • G06F40/166Editing, e.g. inserting or deleting
    • G06F40/177Editing, e.g. inserting or deleting of tables; using ruled lines
    • G06F40/18Editing, e.g. inserting or deleting of tables; using ruled lines of spreadsheets
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/80Information retrieval; Database structures therefor; File system structures therefor of semi-structured data, e.g. markup language structured data such as SGML, XML or HTML
    • G06F16/81Indexing, e.g. XML tags; Data structures therefor; Storage structures

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Audiology, Speech & Language Pathology (AREA)
  • Computational Linguistics (AREA)
  • General Health & Medical Sciences (AREA)
  • Health & Medical Sciences (AREA)
  • Artificial Intelligence (AREA)
  • Software Systems (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • Document Processing Apparatus (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

This application discloses a kind of report form generation methods based on XML, comprising: system intialization all-purpose financial statements template and the CSS file for controlling report style;The XML report data file uploaded is received, and according to the XML report data file and the all-purpose financial statements template generation Report Form Design file;Wherein, the XML report data file is for report logic needed for saving business;The data source, the Report Form Design file and the CSS file generated report that are there is provided according to database are simultaneously supplied to the business and are shown.Using the application, report generation mode can be simplified.

Description

A kind of report form generation method based on XML
Technical field
This application involves computer technology, in particular to a kind of report form generation method based on XML.
Background technique
Currently, there are the modes of two kinds of relatively common generation reports in computer field.Wherein, one is by writing The mode of code, one is in such a way that form library storage creates report.All there is biggish limitation in both modes.Specifically Ground creates a report capability to any, requires exploitation code, again version out by way of code building report;And In such a way that form library storage creates report, production report can only be carried out for the very limited index preset, object, once Then realize, performance all suffers from bottleneck by function for business complexity.
For example, application No. is the 201110152520.0, hairs of entitled " generation method and device of performance report " All data are passed through XML persistence, report are read from XML by bright patent application, the XML mode of use as data source Record.Application No. is 201310489798.6, entitled " a kind of Excel report based on XML is raw in a kind of JSP environment At method " application for a patent for invention, disclose a kind of Excel report implementation based on XML under JSP language environment.This The characteristics of XML data is separated with format is utilized for kind of report implementation and Excel is powerful, format abundant controls sum number According to processing capacity, but close coupling front end JSP realizes the shortcomings that operation with Excel is it.
There are the following problems for these above-mentioned existing report generation modes:
1, a report capability newly is done, needs to recompilate new version by reprograming and support;
Specifically, based on report components such as Birt, a report is newly done, it is necessary first to the mould of report is defined in IDE Plate, then binding data library table are presented by codes such as JAVA/JS back to front end, need to write quantity per a report is newly done Not equal code, repacks version.
2, by way of self-defined report, accomplish that user can configure report, but bring logic once complexity, need Data model is re-established, and performance cost ramps;
Specifically, in order to evade per a kind of report is newly gone out, having a kind of report generation mode, it is not necessary to modify codes, by writing Huge SQL statement will all be associated with data model prior, once intermediate logic changes, change is huge, additionally, due to It is related to the operation associated of all index tables, general SQL complex, performance faces great challenge;
3, business is usually not only only presented in current operation by way of report, it is also necessary to accomplish that figure and report combine Mode, there is presently no only pass through a very simple XML to accomplish the abundant scheme presented of upper figure following table.
Specifically, it can accomplish that report and figure are presented by the figure of Birt itself, but the graphical effect of Birt is non- It is often bad, currently a popular ECharts is failed to provide support, newly-generated report and new figure in current scheme, It need to be completed by writing code respectively, not accomplish an XML file configuration, both can individually show report, it can also be with chart knot It closes, it is not necessary to modify code.
4, XML file does data source, encounters the big scene of data volume, XML load will become very heavy, and not accomplish to count It is separated according to pattern.
Specifically, some schemes contain the XML of initial data by certain rule generations, and one is that data are huge, Performance will face huge bottleneck, in addition for correlation inquiry, be inconvenient, and initial data is deposited in the database, just be not present The problem.
5, by generating Excel by XML, versatility is not high in JSP environment.
Specifically, first front end be based on JSP environment, now for increasingly emphasize sound separation trend for be not just inconsistent It closes, in addition report is not only Excel, is also not enough colluded by Tentative Study of Achievement of Manipulation on Excel, evolution and the equal difficulties of extension.
6, there is the complicated table form such as merging combination for table, can not only be presented by simple XML configuration.
Specifically, the mode that scheme is applicable in XML at present mainly solves the problems, such as data source, and the pattern of report is done not To customized.
Summary of the invention
The application provides a kind of report form generation method based on XML, is capable of providing flexible report configuration, conveniently realizes The generation of report.
To achieve the above object, the application adopts the following technical scheme that
A kind of report form generation method based on XML, comprising:
System intialization all-purpose financial statements template and CSS file for controlling report style;
The XML report data file uploaded is received, and according to the XML report data file and the all-purpose financial statements template Generate Report Form Design file;Wherein, the XML report data file is for report logic needed for saving business;
According to data source, the Report Form Design file and the CSS file generated report of database offer and it is supplied to The business is shown.
Preferably, in the XML report data file include graphic plotting attribute, for assignment graph drawing tool, The type of graphing and the information of reference data;
This method further comprises: according to the graphic plotting attribute in the XML report data file, providing in database Data source in extract and meet the reference data of graphic plotting attribute, according to the type of specified graphing, using specified Graphic plotting tool carries out graphic plotting, and is supplied to the business and is shown.
Preferably, this method further comprises: judging the general report before receiving the XML report data file uploaded Whether table template meets business needs, if conditions are not met, then receiving the Report Form Design file of upload, and executes the generation report And it is supplied to the operation that the business is shown;If it is satisfied, then executing the operation and thereafter for receiving XML report data file Continuous operation.
Preferably, the CSS file of update is checked in specified storage location before the generation report, If it exists, then it utilizes and updates the preset CSS file of channel CSS file replacement system.
Preferably, the graphic plotting tool is ECharts.
As seen from the above technical solution, in the application, preset all-purpose financial statements template and for controlling report sample in systems The CSS file of formula;The XML report data file uploaded is received, and according to the XML report data for saving bordereau logic File and all-purpose financial statements template generation Report Form Design file;Data source, Report Form Design file and the CSS provided further according to database File generated report is simultaneously supplied to business and is shown.By the above-mentioned means, can be by the generation of Report Form Design file and code Engineering removing, when needing to generate new version report, it is only necessary to modify XML report data file, thus provide flexibly Report configuration, simplify report generation mode.
Detailed description of the invention
Fig. 1 is the basic procedure schematic diagram of report form generation method in the application;
Fig. 2 is the example block diagram of report form generation method.
Specific embodiment
In order to which the purpose, technological means and advantage of the application is more clearly understood, the application is done below in conjunction with attached drawing It is further described.
Fig. 1 is the basic procedure schematic diagram of report form generation method in the application.As shown in Figure 1, this method comprises:
Step 101, system intialization all-purpose financial statements template and the CSS file for controlling report style.
Wherein, all-purpose financial statements template is a kind of template of simple general-purpose suitable for most of reports, such as the template can To be the outline border of a report.
CSS file is for controlling report style, such as report background color, shading etc..Existing Report Form Design file (also referred to as For Report Form Design template or report template) in all can include corresponding CSS documentation section, to control the generation and display of report. In the application, this partial content is additionally saved independently of Report Form Design file, it is preset in systems, thus as far as possible Report code is set more to be common to the generation of all kinds of reports.
In addition, the all-purpose financial statements template and CSS file of system intialization can be stored under the specified path of system, facilitates and be System calls.
Specifically, the initialization path setting that each file can be carried out in systems, for example, report can be pre-configured with Root path $ rpt_temp_dir completes the creation $ rpt_temp_dir of report root if being not configured;2), in $ $ XML, $ template, $ XMLTodesign, $ design, $ css, $ css_ext subdirectory are created under rpt_temp_dir again;
Wherein, the purposes of above-mentioned subdirectory is as follows:
$ XML: the XML report data file directory that outside uploads;
$ template: the storing directory of the all-purpose financial statements template of system intialization;
The guarantor for the Report Form Design file that $ XMLTodesign:XML report data file and all-purpose financial statements template file generate Deposit catalogue;
$ designer: the Report Form Design file that outside uploads saves contents;
$ css: the storing directory of the default style control file-CSS file of report;
$ css_ext: the storing directory of the pattern control file of report is extended.
By the all-purpose financial statements template file of system intialization and default css file, it is placed into the resource of report module Mode under catalogue as resource file is supplied to business, and the all-purpose financial statements template that will be bundled under resource catalogue Rpt_template.rptdesign is copied under $ template catalogue;The default under resource catalogue will be bundled to CSS file eplt_rpt_default.css is copied under $ css catalogue;It, can if having existed corresponding document under target directory To be handled according to coverage mode, or can also retain according to file with the presence or absence of the existing file of change judgement covering existing File.
Step 102, the XML report data file of upload is received.
In this step, system receives the XML report data file uploaded.Wherein, XML report data file is for saving industry Report logic needed for business, is designed according to business demand by user and is uploaded to system.It may include report in report logic Format, attribute information, such as the ranks number of report, the attribute informations such as title, the position of gauge outfit items.Pass through XML format, rule Determine report logic, after uploading system, corresponding information is read by system code, thus clear report demand.Pass through XML report data File realizes the separation of business datum and report template design, makes report developer only need to be concerned about business datum, passes through upload XML report data file system bordereau format and demand, then by next step by system generate Report Form Design text Part.
Specifically, XML report data file can be stored in preset storage location, such as save above-mentioned steps Under the $ rpt_temp_dir/ $ XML catalog being arranged in 101.System can also be as needed, reports to the XML saved under the target Table data file carries out the edit operations such as additions and deletions change.The Format Reference of an XML report data file is given below:
Step 103, system is according to the XML report data file and all-purpose financial statements template generation Report Form Design file of upload.
After XML report data file is uploaded, system can be by XML report data file and the all-purpose financial statements preset template It merges, generates Report Form Design file, and the Report Form Design file of generation is stored on preset position, facilitate system tune With the Report Form Design file generated report.Specifically, Report Form Design file can save mentions in a step 101 Under XMLTodesign catalogue.
In addition, including the document content of CSS format in current Report Form Design file, for controlling report style.This Shen Please in, be prefixed CSS file in step 101, can use the generated report of CSS document control Report Form Design file here Pattern.
Step 104, according to database provide data source, Report Form Design file and CSS file generated report and be supplied to Business is shown.
In the application, data needed for report are still provided by database, to mitigate the load of XML file, also can Enough make full use of the advantage of database.Using the data source of database offer, Report Form Design file, and combine CSS file generated Report.The report of the generation can be supplied to business by unified interface, by business in respective interface in desired manner It is shown.Here, the mode for generating report can be realized using the prior art.
So far, report form generation method process most basic in the application terminates.
By the above-mentioned means, all-purpose financial statements template is mutually removed with the code for generating report, and Report Form Design file is divided The generation of new version report is enormously simplified to reach secondary separation decoupling from for business datum and XML report data file Mode provides flexible report configuration.
On the basis of above-mentioned most basic report form generation method, the application can also conveniently realize report and figure is same When the function that shows.Specifically, it can include graphic plotting attribute in XML report data file, be drawn for assignment graph The information of tool, the type of graphing and reference data.By the graph drawing engine in system according to XML report data file In graphic plotting attribute, extracted in the data source that database provides and meet the reference data of graphic plotting attribute, according to finger The type of fixed graphing carries out graphic plotting using specified graphic plotting tool, and is supplied to business and is shown.Example Such as, in the parameter format for the XML report data file that step 102 provides, include in the attribute of column " echart ", that is, indicating should Whether column participate in the graphic plotting for using echart as tool.Wherein, echart attribute value may take 0,1,2,3 etc., can be with For respectively indicating " column data is not involved in graphic plotting ", " graphic plotting of column data participation X-axis ", " column data ginseng With the graphic plotting of Y1 axis ", the graphic plotting of Y2 axis " column data participation ".
When including above-mentioned Image Rendering attribute, can be extracted in the parsing of XML report data file, and utilize Graphic plotting tool carries out graphic plotting.Meanwhile it can will merge the processing for generating design of EDI messages file and figure with common template The processing that shape is drawn separates progress.For example, for shown in step 102 the corresponding of XML file can be parsed according to following sequences Information:
1) data set in database is obtained;
2) querying condition is obtained;
3) list collection is obtained;
4) it obtains and arranges corresponding display name, position, data type, echart attribute;
5a) according to echart attribute value generation ECharts graphical interfaces, can specifically support to be shown as line chart, column The figures presentation modes such as figure;
5b) merge with common template and generate Report Form Design file, and according in the Report Form Design file combined data library Data set generation report;
6) report and figure are shown at business interface, such as figure can combine with report and be rendered into upper figure following table Mode shown.
By the above-mentioned means, can by arbitrary graphic drawing tool (including in traditional Report Form Design graphical control or The graphic plotting tool that third party provides) it is introduced into Report Form Design, as long as system supports the drafting of respective graphical drawing tool, It can use the tool and carry out graphic plotting, to provide more flexible selection for user.
In addition, for some extremely complex reports directly Report Form Design file can also be designed by external tool, so Designed Report Form Design file is uploaded directly into system afterwards, system receives the Report Form Design file uploaded, utilizes the report Table design document generates report together with CSS file and data source.Meanwhile for the CSS file of system intialization, it is preferable that Can by user upload it is updated, if in specified save location there are user upload new CSS file, System can use the preset CSS file of the CSS file replacement system, control the pattern of report, to provide for user cleverer Report style control mode living.
The exemplary block diagram that report generation is carried out using the present processes is given below.As shown in Fig. 2, module 201 for saving the all-purpose financial statements template and default CSS file of threshold value, wherein all-purpose financial statements template can be directed to different feelings Condition provides multiple choices;The customizable CSS file that user uploads to designated storage location is substituted for silent in module 201 Recognize CSS file.Module 202 receives the XML report data file imported.File in module 201 and 202 passes through report file solution The processing of parser module 203 is merged into Report Form Design file, alternatively, can also receive the report of upload by being introduced directly into mode Design document.EPlatform statement management module 204 handles Report Form Design file, generates report;Wherein, module It can also include Birt Report Engine in 204, for being solved to the Report Form Design file using Birt design directly uploaded Analysis processing.
Above-mentioned is the specific implementation of the report form generation method based on XML in the application.From the foregoing, it can be seen that the application exists Following advantages:
1, the separation of report template file and code engineering is realized;
2, built-in common template is separated the design of report template by CSS and XML mode, and CSS file is responsible for report Table sample formula, XML report data file are responsible for the control of report display data;
3, pass through the control of XML report data document definition data source and basic report, graphic plotting, report pattern mould Block parses data source, and identifies in XML report data file whether be configured with while showing figure, if so, then passing through report Table engine generates report, generates figure by graphics engine, report and figure is submitted to business, by business as desired by two Person is combined into chart, and the mode for defaulting upper figure following table co-expresses business by chart mode since data source is consistent;
4, original data are still stored using database, and XML is only responsible for defining data source, defines presentation side Formula, very lightweight;
5, front and back uses the technology of sound separation, directly generates out compiled report file from the background, front end passes through letter Single web container can load out;
6, by defining the corresponding relationship between XML configuration and complex table head template, accomplish gradually to configure respectively using XML Class complex table head, for the complex table head of undefined corresponding relationship out, nested mode is also supported directly to upload designed Report template file, Reports module automatically parse production report.
The foregoing is merely illustrative of the preferred embodiments of the present invention, is not intended to limit the invention, all in essence of the invention Within mind and principle, any modification, equivalent substitution, improvement and etc. done be should be included within the scope of the present invention.

Claims (5)

1. a kind of report form generation method based on XML characterized by comprising
System intialization all-purpose financial statements template and CSS file for controlling report style;
The XML report data file uploaded is received, and according to the XML report data file and the all-purpose financial statements template generation Report Form Design file;Wherein, the XML report data file is for report logic needed for saving business;
According to data source, the Report Form Design file and the CSS file generated report of database offer and it is supplied to described Business is shown;Wherein, the data source is bundled in the XML report data file.
2. the method according to claim 1, wherein including graphic plotting in the XML report data file Attribute, for assignment graph drawing tool, the information of the type of graphing and reference data;
This method further comprises: according to the graphic plotting attribute in the XML report data file, in the number that database provides According to the reference data for meeting graphic plotting attribute is extracted in source, according to the type of specified graphing, specified figure is used Drawing tool carries out graphic plotting, and is supplied to the business and is shown.
3. method according to claim 1 or 2, which is characterized in that, should before receiving the XML report data file uploaded Method further comprises: judging whether the all-purpose financial statements template meets business needs, if conditions are not met, then receiving the report of upload Table design document, and execute the generation report and be supplied to the operation that the business is shown;It is connect if it is satisfied, then executing Receive the operation and its subsequent operation of XML report data file.
4. method according to claim 1 or 2, which is characterized in that before the generation report, in specified storage location On check for the CSS file of update, and if it exists, then using updating the preset CSS text of channel CSS file replacement system Part.
5. according to the method described in claim 2, it is characterized in that, the graphic plotting tool is ECharts.
CN201611019782.9A 2016-11-21 2016-11-21 A kind of report form generation method based on XML Active CN106407172B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201611019782.9A CN106407172B (en) 2016-11-21 2016-11-21 A kind of report form generation method based on XML

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201611019782.9A CN106407172B (en) 2016-11-21 2016-11-21 A kind of report form generation method based on XML

Publications (2)

Publication Number Publication Date
CN106407172A CN106407172A (en) 2017-02-15
CN106407172B true CN106407172B (en) 2019-06-07

Family

ID=58068934

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201611019782.9A Active CN106407172B (en) 2016-11-21 2016-11-21 A kind of report form generation method based on XML

Country Status (1)

Country Link
CN (1) CN106407172B (en)

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107643970A (en) * 2017-09-13 2018-01-30 曙光信息产业(北京)有限公司 What thermal map configured shows method and shows system
CN107609131B (en) * 2017-09-18 2020-04-17 中国银行股份有限公司 Report file generation method and device
CN107844464A (en) * 2017-11-08 2018-03-27 中国科学院、水利部成都山地灾害与环境研究所 Filing system and method based on data insertion
CN108170655A (en) * 2017-12-26 2018-06-15 平安科技(深圳)有限公司 Production method, device, terminal device and the storage medium of Visual Report Forms
CN111061721B (en) * 2018-10-16 2023-07-25 成都鼎桥通信技术有限公司 Data processing method and device

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101650711A (en) * 2009-08-18 2010-02-17 深圳市科陆电子科技股份有限公司 Method for generating report
CN103135988A (en) * 2013-03-11 2013-06-05 银联商务有限公司 Method and system of data processing
CN103455290A (en) * 2013-09-06 2013-12-18 苏州百慧华业精密仪器有限公司 Visio document-based general report template print method
CN103761288A (en) * 2014-01-14 2014-04-30 国家电网公司 Visual chart custom generation system and visual chart custom generation method

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7155670B2 (en) * 2002-01-18 2006-12-26 Internet Disclosure Co., Ltd. Document authoring system and authoring management program
US8745177B1 (en) * 2011-11-01 2014-06-03 Edgecast Networks, Inc. End-to-end monitoring and optimization of a content delivery network using anycast routing

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101650711A (en) * 2009-08-18 2010-02-17 深圳市科陆电子科技股份有限公司 Method for generating report
CN103135988A (en) * 2013-03-11 2013-06-05 银联商务有限公司 Method and system of data processing
CN103455290A (en) * 2013-09-06 2013-12-18 苏州百慧华业精密仪器有限公司 Visio document-based general report template print method
CN103761288A (en) * 2014-01-14 2014-04-30 国家电网公司 Visual chart custom generation system and visual chart custom generation method

Also Published As

Publication number Publication date
CN106407172A (en) 2017-02-15

Similar Documents

Publication Publication Date Title
CN106407172B (en) A kind of report form generation method based on XML
US10379710B2 (en) Modeling system for graphic user interface
CA2951145C (en) Page constructor and page constructing method
US10127206B2 (en) Dynamic column groups in excel
CN102915237B (en) The method and system of rewrite data quality rule is required according to user application
CN105511873B (en) User interface control display method and device
JP2017201547A (en) Automatic report generation method
CN105487864A (en) Method and device for automatically generating code
CN107077752A (en) Data visualization extensible architecture
CN102722372A (en) Method and system for automatically generating codes through classification and configuration
CN103093000A (en) Database query modeling system and database query modeling method
CN104731588B (en) Page layout document generating method and page layout file creating apparatus
CN108762743A (en) Data table operation code generation method and device
CN113703755A (en) Code generation method and code generation device
KR20180135654A (en) Intuitive method of making a program
CN106648338A (en) Method and device for editing data
KR100902193B1 (en) A System For Composing Report, A Method ? A System For Providing A Made-To-Order Report, And A Storage Medium
CN112861060A (en) Page creating method and device, computer equipment and storage medium
CN110532028B (en) Method for generating interface document based on eclipse
CN116611418B (en) Report processing method and device based on online editing, electronic equipment and medium
CN111367976B (en) Method and device for exporting EXCEL file data based on JAVA reflection mechanism
CN112130841B (en) SQL development method and device and terminal equipment
CN117453713A (en) SQL sentence generation method, device and storage medium for multi-type database
CN114064021A (en) Hospital management platform customization method and device based on user requirements and storage medium
CN116610693A (en) Method and device for generating structured query statement and computer equipment

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant