技术领域technical field
本发明涉及计算机应用技术领域,更具体的说,涉及一种可扩展基于脚本的报告生成系统及方法。The present invention relates to the technical field of computer applications, and more specifically relates to an expandable script-based report generation system and method.
背景技术Background technique
Word是世界上使用范围最广泛的文字处理系统,每天都有大量的word报告需要编制,例如在服务器运行日常管理工作中,针对每一台服务器的运行情况都需要编写日报、周报、月报、季报和年报。这些报告的格式几乎都是固定的,只是其中涉及的具体参数和数据不同而已。如果仅依靠人工进行处理,大量的查询、复制和粘贴工作,不但繁琐、耗时、效率低下,而且还容易出错,降低了报告的准确性。因此,研究word报告的自动生成功能具有重要的应用价值。Word is the most widely used word processing system in the world. A large number of word reports need to be prepared every day. For example, in the daily management of server operation, daily, weekly, monthly reports, Quarterly and annual reports. The format of these reports is almost fixed, but the specific parameters and data involved are different. If only relying on manual processing, a large number of queries, copying and pasting tasks are not only cumbersome, time-consuming, inefficient, but also prone to errors, reducing the accuracy of reports. Therefore, it has important application value to study the automatic generation function of word report.
Docx格式是微软定义的最新的Word文件标准格式,它使用XML对文件内容进行标记说明,是一种相对开放的文件格式。The Docx format is the latest Word file standard format defined by Microsoft. It uses XML to mark and describe the content of the file. It is a relatively open file format.
目前,Word报告自动生成方法有以下几种:Currently, there are several ways to automatically generate Word reports:
1、文档光标跟踪定位方法(叶明,张诤,基于C#.NET的Word报告生成功能开发,计算机工程与应用,2008,44(9):104-106)。1. Document cursor tracking and positioning method (Ye Ming, Zhang Zheng, Word report generation function development based on C#.NET, Computer Engineering and Application, 2008, 44(9): 104-106).
该方法的主要原理是通过跟踪和控制Word文档内部光标的位置来控制文档内容的起始和相应的格式,并在相应位置上插入指定的内容。其缺点是:报告的版面、样式和内容必须通过程序顺序输入;此外,该方案不够完整,没有涉及用户对数据信息的筛选操作。The main principle of this method is to control the start of the document content and the corresponding format by tracking and controlling the position of the cursor inside the Word document, and insert the specified content at the corresponding position. Its disadvantages are: the layout, style and content of the report must be input sequentially through the program; in addition, the scheme is not complete, and does not involve the user's screening of data information.
2、利用OLE或COM技术直接控制Word(鲁保玉,杨新芳,用Delphi生成Word报告及动态结构表格,计算机软件与应用,2007,4(3):180-183;孔令彦,黄蓬勃,姜青香等,使用Visual Basic操纵Microsoft Word对象生成报告文档,计算机工程与应用,2003,39(36):115-117)。2. Using OLE or COM technology to directly control Word (Lu Baoyu, Yang Xinfang, Using Delphi to generate Word reports and dynamic structure tables, Computer Software and Applications, 2007, 4(3): 180-183; Kong Lingyan, Huang Pengbo, Jiang Qingxiang et al., Using Visual Basic to Manipulate Microsoft Word Objects to Generate Report Documents, Computer Engineering and Applications, 2003, 39(36): 115-117).
该方法的主要原理是利用OLE或COM技术直接控制Word,将数据库表结构中的列信息作为标签插入Word文档中以定义模板,在Word中添加自定义窗体连接数据库,在生成文档时从数据库中读取数据,并自动填写到模板中的相应位置上。The main principle of this method is to use OLE or COM technology to directly control Word, insert the column information in the database table structure as a label into the Word document to define the template, add a custom form in Word to connect to the database, and generate the document from the database. Read the data in and automatically fill in the corresponding position in the template.
3、基于多种技术的Word文档自动生成方法(葛芬,吴宁,基于多种技术的Word设计文档自动生成平台,电子科技大学学报,2007,36(2))。3. The method of automatic generation of Word documents based on multiple technologies (Ge Fen, Wu Ning, Automatic Generation Platform of Word Design Documents Based on Multiple Technologies, Journal of University of Electronic Science and Technology of China, 2007, 36(2)).
该方法的主要原理是利用VBA将一篇规范的通用文档中可允许被替换的部分采用插入批注的形式设置标签,并把文档及其中的标签信息存储到数据库服务器中,下一步在Asp页面上提供输入框由用户为标签赋值,最后利用用户输入值替换通用文档中标签处的内容生成新的文档。其缺点是:VBA程序全部嵌入到客户端Word应用程序中,部署不够方便;并且VBA界面元素不够丰富,只支持简单的文本录入形式,对于表格、图片等没有后台方法支持。The main principle of this method is to use VBA to set tags in the form of inserting annotations for the part that can be replaced in a standardized general document, and store the document and the tag information in the database server. The next step is on the Asp page Provide an input box for the user to assign a value to the label, and finally use the user input value to replace the content of the label in the general document to generate a new document. Its disadvantages are: all VBA programs are embedded in the client-side Word application program, and the deployment is not convenient enough; and the VBA interface elements are not rich enough, only simple text input forms are supported, and there is no background method support for tables, pictures, etc.
以上技术都主要是直接操作Word文档对象,其共同缺陷是格式控制不灵活,数据处理不方便。The above technologies are mainly to directly manipulate Word document objects, and their common defects are inflexible format control and inconvenient data processing.
发明内容Contents of the invention
本发明针对上述现有技术中存在的技术问题,提供一种可扩展基于脚本的Word报告生成系统及方法,解决了格式控制不灵活、数据处理不方便的问题。The present invention aims at the technical problems existing in the above-mentioned prior art, and provides an expandable script-based Word report generation system and method, which solves the problems of inflexible format control and inconvenient data processing.
为达到上述目的,本发明所采用的技术方案如下:In order to achieve the above object, the technical scheme adopted in the present invention is as follows:
一种可扩展基于脚本的Word报告生成系统,包括Word报告模板定制模块、Word报告模板转换模块、数据访问接口模块。An extensible script-based Word report generation system includes a Word report template customization module, a Word report template conversion module, and a data access interface module.
Word报告模板定制模块,提供了模板定制规范,对用户定制的模板进行错误检测。The Word report template customization module provides template customization specifications and performs error detection on user-defined templates.
Word报告模板转换模块,提供了对用户编写的Word模板进行脚本化的转换过程,最终将生成一个可执行的脚本文件。The Word report template conversion module provides a scripted conversion process for the Word template written by the user, and will eventually generate an executable script file.
数据访问接口模块,定义了如何对数据进行访问,模板中脚本语句通过数据访问接口获取报告数据源数据。The data access interface module defines how to access the data, and the script statement in the template obtains the report data source data through the data access interface.
所述Word报告模板定制模块包括脚本提示模块和脚本检查模块。The Word report template customization module includes a script prompt module and a script check module.
所述Word报告模板转换模块包括脚本动作处理模块、Word段落内容整合模块以及XML到脚本的转换模块,其中,Word段落内容整合模块是将段落内容合并,XML到脚本的转换模块用来将带有脚本标记的XML结果转换为一个可执行的脚本文件。The Word report template conversion module includes a script action processing module, a Word paragraph content integration module and XML to a script conversion module, wherein the Word paragraph content integration module is to merge the paragraph content, and the XML conversion module to the script is used to convert the content with The XML result of the script tag is converted into an executable script file.
所述数据访问接口模块包括数据访问接口的定义模块和具体的数据源访问逻辑模块,其中,数据访问接口的定义模块定义了报告如何访问一个数据,而具体的数据源访问逻辑模块,定义了如何对某个数据源的数据进行访问。The data access interface module includes a data access interface definition module and a specific data source access logic module, wherein the data access interface definition module defines how a report accesses a data, and the specific data source access logic module defines how to Access data from a data source.
一种可扩展基于脚本的Word报告生成方法,采用上述的系统来完成,包括以下步骤:An expandable script-based Word report generation method, which is completed by the above-mentioned system, includes the following steps:
1)编写数据访问接口1) Write data access interface
不局限某种特定的来源数据格式,可以将任意格式的数据生成Word报告,但针对特殊格式的数据需要提供一个数据访问接口,对报告模板定制人员来说只关心使用的数据访问接口,不关心数据格式。It is not limited to a specific source data format, and Word reports can be generated from data in any format, but a data access interface needs to be provided for data in a special format. For report template customizers, they only care about the data access interface used, not the Data Format.
2)定制报告模板2) Custom report template
通过定义的模板脚本编写方式插入脚本,在脚本中控制报告的显示样式,数据处理过程,最终结果就是一份定制好的Word形式的报告模板。Insert the script through the defined template scripting method, control the display style of the report and the data processing process in the script, and the final result is a customized report template in the form of Word.
3)将报告模板转化为可执行的脚本代码3) Convert the report template into executable script code
通过对报告文件格式分析,对Docx文件中的XML文件进行重新调整,生成对应的可执行脚本文件。By analyzing the format of the report file, the XML file in the Docx file is readjusted to generate the corresponding executable script file.
本发明技术方案的有益效果如下:The beneficial effects of the technical solution of the present invention are as follows:
本发明不仅可以非常灵活的定制各种数据内容,而且可以非常灵活的对报告样式进行定制,并且本发明对最终报告结果页数没有限制,几千页报告都可以正常处理。The present invention can not only customize various data contents very flexibly, but also can customize report styles very flexibly, and the present invention has no limit to the number of pages of final report results, and thousands of pages of reports can be processed normally.
附图说明Description of drawings
通过阅读参照以下附图对非限制性实施例所作的详细描述,本发明的其它特征、目的和优点将会变得更明显:Other characteristics, objects and advantages of the present invention will become more apparent by reading the detailed description of non-limiting embodiments made with reference to the following drawings:
图1是本发明一实施例的系统组成框图;Fig. 1 is a system composition block diagram of an embodiment of the present invention;
图2是本发明一实施例的工作流程图。Fig. 2 is a working flow diagram of an embodiment of the present invention.
具体实施方式Detailed ways
下面结合具体实施例对本发明进行详细说明。以下实施例将有助于本领域的技术人员进一步理解本发明,但不以任何形式限制本发明。应当指出的是,对本领域的普通技术人员来说,在不脱离本发明构思的前提下,还可以做出若干变形和改进。这些都属于本发明的保护范围。The present invention will be described in detail below in conjunction with specific embodiments. The following examples will help those skilled in the art to further understand the present invention, but do not limit the present invention in any form. It should be noted that those skilled in the art can make several modifications and improvements without departing from the concept of the present invention. These all belong to the protection scope of the present invention.
图1所示,本发明所提供的可扩展基于脚本的Word报告生成系统,包括,Word报告模板定制模块、Word报告模板转换模块、数据访问接口模块。As shown in FIG. 1 , the scalable script-based Word report generation system provided by the present invention includes a Word report template customization module, a Word report template conversion module, and a data access interface module.
Word报告模板定制模块,又包含脚本提示模块,脚本检查模块。The Word report template customization module also includes a script prompt module and a script check module.
Word报告模板转换模块又包括脚本动作处理模块,Word段落内容整合模块,XML到脚本的转换模块,其中脚本动作处理模块是将一些特殊的动作,例如将脚本移动到XML当前节点外层,应用的XML结构中。Word段落内容整合模块,主要是将段落内容合并,因为Word可能将一个段落内容存储在多个XML节点中,那么如果要分析脚本信息,必须将段落进行合并处理。XML到脚本的转换模块,该模块用来将带有脚本标记的XML结果转换为一个可执行的脚本文件。The Word report template conversion module also includes a script action processing module, a Word paragraph content integration module, and an XML-to-script conversion module. The script action processing module is to apply some special actions, such as moving the script to the outer layer of the current XML node. in the XML structure. The Word paragraph content integration module mainly merges the paragraph content, because Word may store a paragraph content in multiple XML nodes, so if you want to analyze the script information, you must merge the paragraphs. XML to script conversion module, which is used to convert the XML result with script tags into an executable script file.
数据访问接口模块包含了两个部分,一个是数据访问接口的定义模块,另一个是具体的数据源访问逻辑模块,其中,数据访问接口的定义模块定义了报告如何访问一个数据,而具体的数据源访问逻辑模块,则具体的定义了如何对某个数据源的数据进行访问。The data access interface module includes two parts, one is the definition module of the data access interface, and the other is the specific data source access logic module, among them, the definition module of the data access interface defines how the report accesses a data, and the specific data The source access logic module specifically defines how to access the data of a certain data source.
Word报告模板定制模块,提供了模板定制规范,对用户定制的模板进行错误检测。The Word report template customization module provides template customization specifications and performs error detection on user-defined templates.
Word报告模板转换模块,提供了对用户编写的Word模板进行脚本化的转换过程,最终将生成一个可执行的脚本文件。The Word report template conversion module provides a scripted conversion process for the Word template written by the user, and will eventually generate an executable script file.
数据访问接口模块,定义了如何对数据进行访问,模板中脚本语句通过数据访问接口获取报告数据源数据。The data access interface module defines how to access the data, and the script statement in the template obtains the report data source data through the data access interface.
图2所示,本发明提供的基于脚本的Word报告自动生成方法,分为以下步骤:As shown in Fig. 2, the script-based Word report automatic generation method provided by the present invention is divided into the following steps:
1)定义数据访问接口1) Define the data access interface
2)定制模板2) Custom templates
3)模板转换3) Template conversion
3)生成报告3) Generate a report
本发明实施例定义了一种特有的数据接口定义,方便模板定制者对数据接口进行定义说明,基本格式示例如下:The embodiment of the present invention defines a unique data interface definition, which is convenient for template customizers to define and explain the data interface. The basic format example is as follows:
定制模板过程完全在Word文档内完成。本实施例定义了一种Word文档内脚本表达的方式,通过将{}作为特殊标记符号,认为其中内容就是脚本或设置内容,本发明支持多种设置,例如{!}可以用来插入注释信息。The process of customizing templates is done entirely within the Word document. This embodiment defines a way to express scripts in a Word document. By using {} as a special mark symbol, it is considered that the content is the script or setting content. The present invention supports multiple settings, such as {! } can be used to insert comment information.
模板转化过程将用户定制的Word报告模板转换为可执行的脚本。The template conversion process converts user-defined Word report templates into executable scripts.
生成报告的过程就是将各种资源协调妥当,然后执行转化生成的可执行脚本,最终可执行脚本生成的结果就是最终的Word报告。The process of generating a report is to coordinate various resources properly, and then execute the executable script generated by conversion, and the final result of the executable script is the final Word report.
以上对本发明的具体实施例进行了描述。需要理解的是,本发明并不局限于上述特定实施方式,本领域技术人员可以在权利要求的范围内做出各种变形或修改,这并不影响本发明的实质内容。Specific embodiments of the present invention have been described above. It should be understood that the present invention is not limited to the specific embodiments described above, and those skilled in the art may make various changes or modifications within the scope of the claims, which do not affect the essence of the present invention.
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201510070571.7ACN104657340B (en) | 2015-02-10 | 2015-02-10 | Extensible script-based Word report generation system and method |
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201510070571.7ACN104657340B (en) | 2015-02-10 | 2015-02-10 | Extensible script-based Word report generation system and method |
| Publication Number | Publication Date |
|---|---|
| CN104657340A CN104657340A (en) | 2015-05-27 |
| CN104657340Btrue CN104657340B (en) | 2018-09-11 |
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN201510070571.7AActiveCN104657340B (en) | 2015-02-10 | 2015-02-10 | Extensible script-based Word report generation system and method |
| Country | Link |
|---|---|
| CN (1) | CN104657340B (en) |
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN105446945B (en)* | 2015-12-01 | 2017-12-01 | 广东电网有限责任公司电网规划研究中心 | Word marks report-generating method |
| CN112114891A (en)* | 2020-08-04 | 2020-12-22 | 中国电力科学研究院有限公司 | A Visual Word Report Generation System Based on Plug-in |
| CN112035565A (en)* | 2020-09-03 | 2020-12-04 | 天元大数据信用管理有限公司 | Method for generating sql script according to word document |
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN101976235A (en)* | 2010-09-21 | 2011-02-16 | 天津神舟通用数据技术有限公司 | Extensible Word report automatically-generating method based on dynamic web page |
| CN103020027A (en)* | 2012-11-16 | 2013-04-03 | 北京北森测评技术有限公司 | Method, device and system for generating dynamic report |
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| JP2008508638A (en)* | 2004-08-02 | 2008-03-21 | 株式会社ジャストシステム | Document processing means for assigning events to actions in a markup language environment |
| US7861153B2 (en)* | 2005-10-03 | 2010-12-28 | Advisys, Inc. | System and method for document construction |
| CN101383871B (en)* | 2007-09-06 | 2012-02-22 | 中兴通讯股份有限公司 | Network element configuration implementing method and apparatus |
| US8706709B2 (en)* | 2009-01-15 | 2014-04-22 | Mcafee, Inc. | System and method for intelligent term grouping |
| CN102693183B (en)* | 2012-05-30 | 2015-04-01 | 瑞斯康达科技发展股份有限公司 | Method and system for realizing automatic software testing |
| CN103678511B (en)* | 2013-11-25 | 2016-11-16 | 北京奇虎科技有限公司 | Method and device for extracting web page content according to visual template |
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN101976235A (en)* | 2010-09-21 | 2011-02-16 | 天津神舟通用数据技术有限公司 | Extensible Word report automatically-generating method based on dynamic web page |
| CN103020027A (en)* | 2012-11-16 | 2013-04-03 | 北京北森测评技术有限公司 | Method, device and system for generating dynamic report |
| Title |
|---|
| 基于VSTO的Word数据自动化提取及报告生成系统的设计与开发;惠怡静 等;《产业聚焦软件园》;20131001;第59-60页* |
| 基于动态网页的Word报告自动生成方法;刘鹏 等;《计算机工程》;20120305;第38卷(第5期);第279-280、284页* |
| Publication number | Publication date |
|---|---|
| CN104657340A (en) | 2015-05-27 |
| Publication | Publication Date | Title |
|---|---|---|
| Buels et al. | JBrowse: a dynamic web platform for genome visualization and analysis | |
| US10565293B2 (en) | Synchronizing DOM element references | |
| CN104484216B (en) | Service interface document and on-line testing instrument generation method, device | |
| TWI578220B (en) | Simulation of web applications and secondary devices in a web browser, web application development tools, and methods using the same | |
| CN104317587A (en) | Automatic android mobile device oriented application generation method | |
| CN108762743B (en) | Data table operation code generation method and device | |
| CN104424265B (en) | Digital asset management method and system | |
| US20110055687A1 (en) | Generating formatted documents | |
| CN107943465B (en) | Method and device for generating HTML form | |
| CN105528418B (en) | A kind of design documentation generation method and device | |
| WO2016032080A1 (en) | Chart conversion system using metadata and method therefor | |
| CN113609820A (en) | Method, device and equipment for generating word file based on extensible markup language file | |
| CN104731588B (en) | Page layout document generating method and page layout file creating apparatus | |
| CN105589959A (en) | Form processing method and form processing system | |
| CN107678777A (en) | A kind of management method of software document, device and terminal | |
| US20130124969A1 (en) | Xml editor within a wysiwyg application | |
| CN101201833A (en) | PDF document data filling system and method | |
| CN104657340B (en) | Extensible script-based Word report generation system and method | |
| US12405847B2 (en) | Artificial intelligence based integration frameworks | |
| CN111142871B (en) | A front-end page development system, method, device, and medium | |
| CN105718434A (en) | Natural language formula editing method and system | |
| CN111401005B (en) | Text conversion method, device and readable storage medium | |
| CN105229564B (en) | The visualization interface of information object system | |
| CN115828866A (en) | A method and device for importing and exporting Excel data | |
| TWI522824B (en) | Method for generating form validation program and corresponding form interface from result set metadata |
| Date | Code | Title | Description |
|---|---|---|---|
| C06 | Publication | ||
| PB01 | Publication | ||
| C10 | Entry into substantive examination | ||
| SE01 | Entry into force of request for substantive examination | ||
| CB02 | Change of applicant information | ||
| CB02 | Change of applicant information | Address after:201203 Shanghai City, Pudong New Area Chinese (Shanghai) free trade zone 498 GuoShouJing Road No. 14 building block 22301-985 Applicant after:VISION MICROSYSTEMS (SHANGHAI) Co.,Ltd. Address before:201203 Shanghai Guo Shou Jing Road, Zhangjiang High Tech Park of Pudong New Area No. 498 Pudong Software Park building 14, block 22301-985 Applicant before:VISION MICROSYSTEMS (SHANGHAI) CO.,LTD. | |
| GR01 | Patent grant | ||
| GR01 | Patent grant | ||
| CP03 | Change of name, title or address | ||
| CP03 | Change of name, title or address | Address after:Block 22301-985, Building 14, No. 498 Guo Shoujing Road, China (Shanghai) Pilot Free Trade Zone, Pudong New Area, Shanghai, March 2012 Patentee after:Shanghai Chuangjing Information Technology Co.,Ltd. Country or region after:China Address before:Block 22301-985, Building 14, No. 498 Guo Shoujing Road, China (Shanghai) Pilot Free Trade Zone, Pudong New Area, Shanghai, March 2012 Patentee before:VISION MICROSYSTEMS (SHANGHAI) Co.,Ltd. Country or region before:China |