A problem recently encountered in the personnel file management system is the problem of multiple types and large quantities of report printing. One feature of this system is letter printing, various letter of introduction, and various Letter of proof. For such repetitive functions, the best way is to apply the formats of all reports.
After analysis, we found that the information in the report can be divided into two parts: the subject content of the letter, that is, the unified content of all the same types of letters, and the personal information (name, gender, etc) that is, the content that often needs to be changed in the same letter, and this part of content comes from the web page (personal file details ). After the analysis, we found that as long as the report format and body content are well defined, as long as the frequently changing information from the web page is put into the report, the report can be generated, in this way, a report of the same type can be applied in one format.
Implementation Structure
Functions
The webpage (foreground) obtains the archive information in the database through the background.
The content and format of the report body are defined in the XML file. XML, as an effective tool for data transmission and storage, is no longer suitable for defining the subject content and content format of the stored report. As a configuration file, XML not only ensures the uniformity of the report format and content, but also makes the report changeable. The scope of change covers the report content and format.
Javascript processes the obtained webpage information and the letter content and format information in the read XML, and finally integrates the information through the processing of VBA to obtain a unified report of the format content.
Technical Points
Javascript interacts with the webpage (JavaScript interacts with the webpage to obtain the webpage information ).
Javascript reads XML files (JavaScript obtains the subject content and format of a letter from the XML file ).
VBA operation (operations on the content and format of word ).
JavaScript and VBA integrate the report content and set the report format.
Summary
With initial ideas, we have achieved a majority in technology. The interaction between JavaScript and web page information is very simple. Javascript reads XML files and integrates report information into reports, you can use VBA to control the report format (layout, font size setting, and page margin setting. In this structure, any report of any person can be obtained: personal information is dynamically obtained from the web page, and the report content and format are obtained from the configuration file (XML, you only need to modify the configuration file to dynamically modify the report content and format.