CN109857670A - A kind of test report automatic generation method based on common template - Google Patents

A kind of test report automatic generation method based on common template Download PDF

Info

Publication number
CN109857670A
CN109857670A CN201910116618.7A CN201910116618A CN109857670A CN 109857670 A CN109857670 A CN 109857670A CN 201910116618 A CN201910116618 A CN 201910116618A CN 109857670 A CN109857670 A CN 109857670A
Authority
CN
China
Prior art keywords
report
common template
test
text
document
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.)
Granted
Application number
CN201910116618.7A
Other languages
Chinese (zh)
Other versions
CN109857670B (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.)
Taicang T&W Electronics Co Ltd
Original Assignee
Taicang T&W Electronics Co 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 Taicang T&W Electronics Co Ltd filed Critical Taicang T&W Electronics Co Ltd
Priority to CN201910116618.7A priority Critical patent/CN109857670B/en
Publication of CN109857670A publication Critical patent/CN109857670A/en
Application granted granted Critical
Publication of CN109857670B publication Critical patent/CN109857670B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Abstract

The invention discloses a kind of test report automatic generation method based on common template, comprising the following steps: creation common template, Form Handle, graphics process and report output;The present invention is mainly based on Visual Basic programming language, it is programmed with " domain " and " macro " two functions of Word software using VBA in conjunction with the mould plate technique of document, realize that text, table, figure automatically process, to automatically generate Word test report.The present invention can not only make test report production reduce workload, improve working efficiency, play a multiplier effect, and equally applicable for other industry test reports.

Description

A kind of test report automatic generation method based on common template
Technical field
The present invention relates to technical field of data processing more particularly to a kind of test report based on common template to automatically generate Method.
Background technique
As research and development or Test Engineer, there is report to need to work out, and these reports are all based on various common templates Format, such as company's template, client's template etc..It is in most cases only project name therein, test configurations, test Data, chart are different, labour so in cycles, if by manually by Computerized Editing table, record personal data, Curve is drawn, not only the amount of labour is huge, but also is easy error.What therefore research testing experiment was reported automatically generates with important Application value.
Summary of the invention
It is an object of the invention in view of the above shortcomings of the prior art, provide a kind of test report based on common template Automatic generation method.
To solve the above problems, the technical solution used in the present invention is:
A kind of test report automatic generation method based on common template, comprising the following steps:
Create common template;A blank Word document is created, according to the demand of report, adds header page in a document The static texts such as foot, title, explanation, text box, separator are inserted into bookmark, domain in the position for needing dynamic to change content, by this One document is as common template;
Form Handle;The test data that report needs is read, data are sequentially displayed in the list of MSFlexGrid control In, then quoting general template, a region is selected at corresponding paragraph, according to the line number of MSFlexGrid control and columns benefit Table is created with VBA language, and test data is sequentially inserted into table, alignment thereof then is carried out, around side to table The formatting of the attributes such as formula, ranks size, cell size, frame shading is handled;
Graphics process;Test data is saved, data file is directly read in report preparing system, is called PictureBox ActiveX drafting goes out the corresponding curve of this file, and filename is shown above curve, then passes through crawl screen The method of curtain obtains PictureBox control regions, is saved as picture format, and set storing path, then quoting general The text box of template calls bookmark, picture is pasted text according to the path of setting by the picture reproduction to clipbook of preservation In this frame;
Report output;Direct printed report document is chosen whether as needed, if so, display the Page Setup or Print dialog box, from The dialog box obtains the page number value of printing;Otherwise, it shows the Save dialog box, will be reported according to the path of user's selection and filename Announcement is saved in file.
Further, it in the creation common template, if report needs to be inserted into table, first has to set insertion table Paragraph, then in next section of insertion page break, become a region;If report needs to be inserted into multiple groups figure, general The appropriate place insertion text box of template, carries out the formats editors such as size to each text box, then be inserted into each text box Bookmark, and be numbered.
Further, in the Form Handle, if field character itself is more, field is intercepted into branch with macrolanguage, And set ranks away from the attributes such as character script, size, alignment thereof;If field number is more, document range is had exceeded, then With macrolanguage reset margin away from, paper mold, the page setups attribute such as vertically and horizontally.
Further, in the graphics process, for multiple groups curve, picture is successively saved by digital number, is then drawn Bookmark is called, picture is pressed according to the path of setting by the picture reproduction to clipbook of preservation with the text box of common template Serial number pastes in text box.
The beneficial effects of adopting the technical scheme are that
Using the automatic generating software of Visual Basic language development Word test report, mechanism is simple, exploitation code Less, convenient to the processing of table and figure effective;It so that test report production is reduced workload, improve working efficiency, It plays a multiplier effect, and equally applicable for other industry test reports.
Detailed description of the invention
Fig. 1 is that test report of the invention generates block schematic illustration.
Specific embodiment
Embodiments of the present invention are described in further detail with reference to the accompanying drawings and examples.Following embodiment is used for Illustrate the present invention, but cannot be used to limit the scope of the invention.
The present invention is soft with Word in conjunction with the mould plate technique of document mainly based on Visual Basic programming language " domain " and " macro " two functions of part are programmed using VBA (Visual Basic for Applications), Lai Shixian text, Table, figure automatically process, to automatically generate Word test report.
The test report of specification includes at least the three parts such as text, table, figure, in order to keep report beautiful, not only to close Reason ground arranges text, table, the position between figure etc., will also font, paragraph, frame, shading etc. to text to do centainly Setting, while also to format table, figure etc..Therefore, the core work of Word report preparing system be to text, The automatic processing of table, figure, especially multilist, multiple graphs;Fig. 1 is that test report of the invention generates frame diagram.
The invention discloses a kind of test report automatic generation method based on common template, comprising the following steps:
Create common template;In order to avoid inputting identical information repeatedly or making the form modifying of repeatability, mould is referred to Plate technique;A blank Word document is created, is added in a document according to the method for modification common document according to the demand of report Add the static texts such as headerfooter, title, explanation, text box, separator, is inserted into book in the position for needing dynamic to change content Label, domain, using this document as common template;
For example, ordinary test report all includes test period, we only need to be inserted into bookmark in a document, use in systems VBA code is inserted into-a " date and time domain " at this bookmark, can automatically generate current time in report, and can compare accordingly Compared with the testing meter and instrument for judging to use in report whether within calibrating validity period;If report needs to be inserted into table, first have to The paragraph of insertion table is set, then in next section of insertion " page break ", becomes a region;If report needs to be inserted into Multiple groups figure carries out the formats editors such as size to each text box, then in each text in the appropriate place insertion text box of template It is inserted into bookmark in this frame, and is numbered.
Form Handle;Table is the pith of test report, but the content of table has dynamic changeability, main to show : (1) the being not fixed property of table;(2) changeability of field itself;(3) changeability of field number.These factors to table from Dynamic generation causes very big difficulty.In view of the dynamic of the complete of test report, ornamental and table, we pass through VB Using VBA macrolanguage, report content is output in Word document, by Word application program or directly uses VBA language Printing.
Firstly, reading the test data that report needs, data are sequentially displayed in the list of MSFlexGrid control, then Quoting general template selects a region at corresponding paragraph, utilizes VBA according to the line number of MSFlexGrid control and columns Language creates table, and test data is sequentially inserted into table, then carries out alignment thereof, around mode, row to table The formatting of the attributes such as column size, cell size, frame shading is handled;
If field character itself is more, field is intercepted into branch with macrolanguage, and set ranks away from character script, big The attributes such as small, alignment thereof;If field number is more, document range is had exceeded, then resets margin away from, paper with macrolanguage Type, the page setups attribute such as vertically and horizontally.
Graphics process;After the completion of test, it usually needs the variation for drawing out certain parameters or characteristic in test report is bent Line.To solve this problem, test data is saved as the file formats such as * .dat when doing measurement test by us, is given birth in report At data file is directly read in system, PictureBox ActiveX drafting is called to go out the corresponding curve of this file, and by filename Be shown in above curve, PictureBox control regions then obtained by the method for capture screen, be saved as * .bmp or The picture formats such as person * .jpg, can be directly used EMC test the test curve of the picture format of external laboratory, And set storing path.For multiple groups curve, picture is successively saved by digital number, such as: 1.bmp, 2.bmp etc..Then draw Bookmark is called, picture is pressed according to the path of setting by the picture reproduction to clipbook of preservation with the text box of common template Serial number pastes in text box.
Report output;Direct printed report document is chosen whether as needed, if so, display the Page Setup or Print dialog box, from The dialog box obtains the page number value of printing, as long as report can directly be printed by being connected with printer on computer;Otherwise, it shows Report is saved in some file by the Save dialog box according to the path and filename of user's selection.
After this method software realization, if test report producer according to the prompt of script file, in computer interface The element and test resolution of the upper some keys of input store path, so that it may the test report needed for being generated based on common template It accuses.
Finally, it should be noted that the above embodiments are merely illustrative of the technical solutions of the present invention, rather than its limitations;Although Present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that: it still may be used To modify to technical solution documented by previous embodiment or equivalent replacement of some of the technical features;And These are modified or replaceed, the spirit and model of technical solution of the embodiment of the present invention that it does not separate the essence of the corresponding technical solution It encloses.

Claims (4)

1. a kind of test report automatic generation method based on common template, which comprises the following steps:
Create common template;A newly-built blank Word document adds static text according to the demand of report in a document, Dynamic is needed to change position the insertion bookmark, domain of content, using this document as common template;
Form Handle;The test data that report needs is read, data are sequentially displayed in the list of MSFlexGrid control, then The common template is quoted, a region is selected at corresponding paragraph, according to the line number of MSFlexGrid control and columns benefit Table is created with VBA language, and test data is sequentially inserted into table, at the formatting that attribute is then carried out to table Reason;
Graphics process;Test data is saved, data file is directly read in report preparing system, calls PictureBox control Part draws out the corresponding curve of this file, and filename is shown above curve, is then obtained by the method for capture screen PictureBox control regions are saved as picture format, and set storing path, then the text in quoting general template Frame calls bookmark, picture is pasted in text box according to the path of setting by the picture reproduction to clipbook of preservation;
Report output;Direct printed report document is chosen whether as needed, if so, display the Page Setup or Print dialog box, right from this Talk about the page number value that frame obtains printing;Otherwise, it shows the Save dialog box, protects report according to the path and filename of user's selection It is stored in file.
2. a kind of test report automatic generation method based on common template according to claim 1, which is characterized in that institute It states in creation common template, if report needs to be inserted into table, first has to the paragraph for setting insertion table, then insert at next section Enter page break, becomes a region;If report needs to be inserted into multiple groups figure, in the appropriate place insertion text of common template This frame carries out format editor to each text box, then is inserted into bookmark in each text box, and be numbered.
3. a kind of test report automatic generation method based on common template according to claim 1, which is characterized in that institute It states in Form Handle, if field character itself is more, field is intercepted into branch with macrolanguage, and set attribute;If field Number is more, has exceeded document range, then resets page setup attribute with macrolanguage.
4. a kind of test report automatic generation method based on common template according to claim 1, which is characterized in that institute It states in graphics process, for multiple groups curve, picture is successively saved by digital number, then the text in quoting general template Frame calls bookmark, picture is pasted text box by serial number according to the path of setting by the picture reproduction to clipbook of preservation In.
CN201910116618.7A 2019-02-15 2019-02-15 Test report automatic generation method based on universal template Active CN109857670B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910116618.7A CN109857670B (en) 2019-02-15 2019-02-15 Test report automatic generation method based on universal template

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910116618.7A CN109857670B (en) 2019-02-15 2019-02-15 Test report automatic generation method based on universal template

Publications (2)

Publication Number Publication Date
CN109857670A true CN109857670A (en) 2019-06-07
CN109857670B CN109857670B (en) 2022-02-22

Family

ID=66897945

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910116618.7A Active CN109857670B (en) 2019-02-15 2019-02-15 Test report automatic generation method based on universal template

Country Status (1)

Country Link
CN (1) CN109857670B (en)

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110991156A (en) * 2019-11-20 2020-04-10 哈尔滨工程大学 Automatic report generation method based on ship numerical value virtual test
CN111931468A (en) * 2020-07-13 2020-11-13 珠海格力电器股份有限公司 Method and device for generating inspection report, electronic equipment and storage medium
CN112100996A (en) * 2020-08-26 2020-12-18 中国航空工业集团公司济南特种结构研究所 Method for automatically generating electrical measurement report for antenna housing
CN112541322A (en) * 2020-12-16 2021-03-23 山东师范大学 Pseudo code automatic formatting method and system based on Word document
CN112764731A (en) * 2021-01-19 2021-05-07 上海擎昆信息科技有限公司 Software interface maintenance method, system, computer equipment and storage medium
CN113950095A (en) * 2020-07-16 2022-01-18 大唐移动通信设备有限公司 Measurement report processing method and device, electronic equipment and storage medium
CN115562979A (en) * 2022-09-27 2023-01-03 上海艾柯检测科技有限公司 Method for automatically generating test report based on artificial intelligence

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20040249664A1 (en) * 2003-06-05 2004-12-09 Fasttrack Systems, Inc. Design assistance for clinical trial protocols
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
CN105279301A (en) * 2015-05-29 2016-01-27 南京市城市规划编制研究中心 Customizable-output plan design method
CN105446945A (en) * 2015-12-01 2016-03-30 广东电网有限责任公司电网规划研究中心 Word mark report generation method

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20040249664A1 (en) * 2003-06-05 2004-12-09 Fasttrack Systems, Inc. Design assistance for clinical trial protocols
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
CN105279301A (en) * 2015-05-29 2016-01-27 南京市城市规划编制研究中心 Customizable-output plan design method
CN105446945A (en) * 2015-12-01 2016-03-30 广东电网有限责任公司电网规划研究中心 Word mark report generation method

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
肖斌: ""基于C#快速生成word报告"", 《计算机系统应用》 *

Cited By (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110991156A (en) * 2019-11-20 2020-04-10 哈尔滨工程大学 Automatic report generation method based on ship numerical value virtual test
CN110991156B (en) * 2019-11-20 2023-05-23 哈尔滨工程大学 Automatic report generation method based on ship numerical virtual test
CN111931468A (en) * 2020-07-13 2020-11-13 珠海格力电器股份有限公司 Method and device for generating inspection report, electronic equipment and storage medium
CN111931468B (en) * 2020-07-13 2023-12-08 珠海格力电器股份有限公司 Verification report generation method and device, electronic equipment and storage medium
CN113950095A (en) * 2020-07-16 2022-01-18 大唐移动通信设备有限公司 Measurement report processing method and device, electronic equipment and storage medium
CN112100996A (en) * 2020-08-26 2020-12-18 中国航空工业集团公司济南特种结构研究所 Method for automatically generating electrical measurement report for antenna housing
CN112541322A (en) * 2020-12-16 2021-03-23 山东师范大学 Pseudo code automatic formatting method and system based on Word document
CN112764731A (en) * 2021-01-19 2021-05-07 上海擎昆信息科技有限公司 Software interface maintenance method, system, computer equipment and storage medium
CN115562979A (en) * 2022-09-27 2023-01-03 上海艾柯检测科技有限公司 Method for automatically generating test report based on artificial intelligence
CN115562979B (en) * 2022-09-27 2023-04-25 上海艾柯检测科技有限公司 Method for automatically generating test report based on artificial intelligence

Also Published As

Publication number Publication date
CN109857670B (en) 2022-02-22

Similar Documents

Publication Publication Date Title
CN109857670A (en) A kind of test report automatic generation method based on common template
CN110442822B (en) Method, device, equipment and storage medium for displaying small program content
CN106469140A (en) A kind of report generating system and its method
CN106339363B (en) A kind of production method and device of PPT report
CN107544808A (en) The generation method and device of a kind of web form
CN114330233A (en) Method for realizing correlation between electronic form content and file through file bottom
US20070067336A1 (en) Electronic publishing system and method for managing publishing requirements in a neutral format
CN111309313A (en) Method for quickly generating HTML (hypertext markup language) and storing form data
CN111104557A (en) Heterogeneous document processing system and method based on standard document markup language specification
Faulkner et al. HTML 5.2
CN104298721A (en) Split screen layout editing method for any number of objects in on-line courseware making based on Web
CN111752999A (en) Configured report generation system and method
CN109710250A (en) It is a kind of for constructing the visualization engine system and method for user interface
CN101038583B (en) Gold report generating and generating method thereof
ATE513265T1 (en) METHOD AND DEVICE FOR EDITING DIGITAL GRAPHIC SVG DOCUMENTS USING A BROWSER
US20070162848A1 (en) Predictive styling
KR102649627B1 (en) An automatic image placement and execution method using the DTP program, an adobe indesign
CN101944081A (en) Computer generation, edition method of Guqin abbreviated character notation and system thereof
JP2002288153A (en) Application-independent data forming method, information processing program, and layout information processing system
CN115221840A (en) PDM system-oriented business document structured dynamic form configuration method
CN112597750A (en) Method, editor and medium for online designing dynamic detection report template
CN114118026B (en) Automatic document generation method and device, computer storage medium and electronic equipment
CN113011148A (en) Method, device, equipment and medium for automatically outputting file with specified format
CN112380826A (en) Formatted electronic form generation method based on text file
CN112287650A (en) Intelligent generation method, system and device for well logging interpretation report

Legal Events

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