Expansible Word report preparing systems and method based on script
Technical field
The present invention relates to computer application technologies, more specifically, being related to a kind of expansible report based on script
Generate system and method.
Background technology
Word is the widest word processor of use scope in the world, has a large amount of word reports to need to compile daily
System, such as in server runs daily management mission, be required for writing daily paper, week for the operating condition of each server
Report, monthly magazine, quarterly report and annual report.The format of these reports is almost fixed, the design parameter and data being only directed to
It is different.It is manually handled if only relied on, a large amount of inquiry, duplication and application work, not only cumbersome, time-consuming, efficiency
Lowly, it and is also easy to malfunction, reduces the accuracy of report.Therefore, the automatic generation function of research word reports has weight
The application value wanted.
Docx formats are the newest Word file reference formats that Microsoft defines, it is using XML to file content into rower
Note explanation, is a kind of file format of opposing open.
Currently, Word report automatic generation method have it is following several:
1, document cursor tracking localization method (Ye Ming, Zhang Zheng, the Word Report Generation Function Baseds exploitation based on C#.NET, meter
Calculation machine engineering and application, 2008,44 (9):104-106).
The cardinal principle of this method is to control document content by tracking and controlling Word document interior lights target position
Starting and corresponding format, and specified content is inserted on corresponding position.The disadvantage is that:The space of a whole page of report, pattern and interior
Appearance must be sequentially inputted by program;In addition, the program is sufficiently complete, without reference to user to the screening operation of data information.
2, it directly controls Word using OLE or COM technologies (Lu Baoyu, Yang Xinfang generates Word reports and dynamic with Delphi
State structure table, computer software and application, 2007,4 (3):180-183;Kong Lingyan, yellow flourishing, Jiang Qingxiang etc. is used
Visual Basic manipulate Microsoft Word objects and generate report file, computer engineering and application, 2003,39 (36):
115-117)。
The cardinal principle of this method is to directly control Word using OLE or COM technologies, and the row in database table structure are believed
Breath is inserted into Word document as label with definition template, and self-defined forms connection database is added in Word, is generating text
Data are read from database when shelves, and on the corresponding position in Auto-writing to template.
3, (Ge Fen, Wu Ning, the Word designs based on multiple technologies of the Word document automatic generation method based on multiple technologies
Document automatic Generation Platform, Journal of UEST of China, 2007,36 (2)).
The cardinal principle of this method is to be used the part for allowing to be replaced in the general file of a specification using VBA
Label is arranged in the form for being inserted into annotation, and in document and label information therein storage to database server, exists in next step
It is label assignment that input frame is provided on the Asp pages by user, and user input values is finally utilized to replace in general file at label
Content generates new document.The disadvantage is that:VBA programs have fully embedded into client Word application programs, and deployment is not convenient enough;
And VBA interface elements are not abundant enough, only support simple Characters form, do not have backstage method for table, picture etc.
It supports.
The above technology all mainly directly operates Word document object, and common defects are that format controls dumb, data
Processing is inconvenient.
Invention content
The present invention for the above-mentioned prior art present in technical problem, provide it is a kind of it is expansible based on script Word report
It accuses and generates system and method, solve the problems, such as that format controls that dumb, data processing is inconvenient.
In order to achieve the above objectives, the technical solution adopted in the present invention is as follows:
A kind of expansible Word report preparing systems based on script, including Word report templates customized module, Word report
Slide former conversion module, data access interface module.
Word report template customized modules, provide model customization specification, and error detection is carried out to customized template.
Word report template conversion modules provide the transfer process that scripting is carried out to the Word templates that user writes,
An executable script file will finally be generated.
Data access interface module defines how to access to data, and script sentence passes through data access in template
Interface obtains data reporting source data.
The Word report templates customized module includes script prompt module and script check module.
The Word report templates conversion module include Script Action processing module, Word paragraph contents integrate module and
Conversion modules of the XML to script, wherein it is to merge paragraph content that Word paragraph contents, which integrate module, the conversion of XML to script
Module is used for the XML results with script markup being converted to an executable script file.
The data access interface module includes that the definition module of data access interface and specific data source access logic
Module, wherein the definition module of data access interface defines how report accesses a data, and specific data source accesses
Logic module defines how to access to the data of some data source.
A kind of expansible Word report-generating methods based on script, are completed, including following step using above-mentioned system
Suddenly:
1) data access interface is write
Do not limit to certain specific derived data format, the data of arbitrary format can be generated to Word reports, but be directed to
The data of special format need to provide a data access interface, and the data used are only concerned for report template customization personnel
Access interface is indifferent to data format.
2) report template is customized
It is inserted into script by the template script edit mode of definition, the Show Styles of control report in script, at data
Reason process, final result are exactly the report template of a Word forms customized.
3) report template is converted to executable scripted code
By to report file format analysis, being readjusted to the XML file in Docx files, generation is corresponding can
Perform script file.
Technical solution of the present invention has the beneficial effect that:
The present invention not only can flexibly customize various data contents very much, but also can be very flexibly to report style
It is customized, and to Final Report result number of pages, there is no limit thousands of pages of reports can be handled normally the present invention.
Description of the drawings
Upon reading the detailed description of non-limiting embodiments with reference to the following drawings, other feature of the invention,
Objects and advantages will become more apparent upon:
Fig. 1 is the block diagram of system of one embodiment of the invention;
Fig. 2 is the work flow diagram of one embodiment of the invention.
Specific implementation mode
With reference to specific embodiment, the present invention is described in detail.Following embodiment will be helpful to the technology of this field
Personnel further understand the present invention, but the invention is not limited in any way.It should be pointed out that the ordinary skill of this field
For personnel, without departing from the inventive concept of the premise, various modifications and improvements can be made.These belong to the present invention
Protection domain.
Shown in Fig. 1, the expansible Word report preparing systems based on script provided by the present invention, including, Word reports
Model customization module, Word report templates conversion module, data access interface module.
Word report template customized modules, and include script prompt module, script check module.
Word report templates conversion module includes Script Action processing module again, and Word paragraph contents integrate module, and XML is arrived
The conversion module of script, wherein Script Action processing module are by some special actions, such as that script is moved to XML is current
Node outer layer, in the XML structure of application.Word paragraph contents integrate module, mainly merge paragraph content, because Word can
One paragraph content can be stored in multiple XML nodes, if that analyze script information, it is necessary to merge paragraph
Processing.XML to script conversion module, the module be used for by the XML results with script markup be converted to one it is executable
Script file.
Data access interface module contains two parts, one be data access interface definition module, the other is
Specific data source accesses logic module, wherein the definition module of data access interface defines how report accesses a number
According to, and specific data source accesses logic module, then specifically defines how to access to the data of some data source.
Word report template customized modules, provide model customization specification, and error detection is carried out to customized template.
Word report template conversion modules provide the transfer process that scripting is carried out to the Word templates that user writes,
An executable script file will finally be generated.
Data access interface module defines how to access to data, and script sentence passes through data access in template
Interface obtains data reporting source data.
Shown in Fig. 2, the Word provided by the invention based on script reports automatic generation method, is divided into following steps:
1) data access interface is defined
2) custom built forms
3) template switch
3) report is generated
The embodiment of the present invention defines a kind of distinctive data-interface definition, and facilitating model customization, person carries out data-interface
Definition explanation, basic format example are as follows:
Custom built forms process is completed in Word document completely.The present embodiment defines script expression in a kind of Word document
Mode, by that { } will be used as special marking symbol, it is believed that wherein content is exactly script or set content, and present invention support is a variety of
Setting, such as!Can be used for being inserted into annotation information.
Customized Word report templates are converted to executable script by template conversion process.
The process for generating report is exactly that various resource coordinations are appropriate, then executes the executable script being converted into, most
The result that executable script generates eventually is exactly that final Word is reported.
Specific embodiments of the present invention are described above.It is to be appreciated that the invention is not limited in above-mentioned
Particular implementation, those skilled in the art can make various deformations or amendments within the scope of the claims, this not shadow
Ring the substantive content of the present invention.