Delphi is good at doing database system development, its function is powerful, the development is fast. But now most of the database system 80% of the work is a simple deletion and modification of the work, with the database system to achieve additions and deletions, the existence of input is not convenient, easy to input content, especially for processing a large number of text and pictures of the database system is very inconvenient. Report output also needs to be developed using report tools or Third-party print controls that are available in each version of Delphi. Although the report tools provided by Delphi are becoming more and more powerful, it is more convenient to use, but if you want to make full use of the report tools to develop powerful and practical reports, you still have to spend a certain amount of energy to learn the features of the report components. For example, the Qreport reporting tool provided in DELPHI6 is cumbersome to make complex reports, and perhaps Borland also notices the problem, so when it comes to Delphi7, it's replaced by a rave reporting tool, which is easier to use than qreport. However, if you want to make a complex report, you still need to study it in detail.
While doing word processing, most users in China are accustomed to using Office, and the most common use of office is word. As a result, most users are familiar with Word operations, word in the data entry aspects of the powerful is indeed unmatched, in Word, whether simple text, tables or pictures can easily input, using the printing function of Word itself can also be used as a report output tool.
Design idea of Delphi+word database system
Combined with the characteristics of Delphi and Word itself, the database system can use such a design idea: Word as the data entry interface, after entry, the database system automatically extracts the data from Word, and the extracted elements stored in the datasheet, In order to use the database system's powerful data processing function to the data table content maintenance, the retrieval, the statistics and so on, and has the word as the report output tool.
Delphi from Delphi5 began just to provide the interface with Word-twordapplication, the use of this interface to enable Word to open, close, save and the content of the document to deal with accordingly. Using the above system design idea and Delphi to provide the data interface with Word, the author developed a set of results-based management system. The main content of the results-based management system is to manage the content of the final outcome document, including the detailed content, the picture of the text, the reserve of the result, the Fund, the prize, etc., in order to facilitate the statistical analysis and ensure the consistency of the content of the results, the system will be unified in the corresponding The following detailed description of the system design ideas, see Figure 1.
Fig. 1 Flowchart of system design idea
First of all, sift through the necessary results elements using Word as an input template. A Word template is more common in two ways: inserting a bookmark at the appropriate location in a Word document, or inserting a special symbol at the appropriate location in a Word document. To insert a bookmark, select the area where you want to insert the bookmark, choose the bookmark in Word's Insert menu, fill in the bookmark name, and click Add. The idea of inserting special symbols in a Word document is to wrap the content that needs to be extracted with special characters, and the system uses special characters to identify what to import, such as # China #, which means that China is the content to be extracted. But the use of the above two template making methods are flawed, especially the template as a output interface, but also as input interface. First of all, the use of Bookmark template method, the user in the actual data entry process, it is easy to delete the bookmark mistakenly. The method of inserting special symbols undoubtedly increases the burden of user input, and the interface is also not beautiful, does not maintain the original document. However, the basic ideas of the two methods are the same, that is, to create feature symbols to extract elements.
For reference to the successful experience of the two template design methods, the author put forward the template design idea is: all the elements of the results are stored in different forms of Word documents, using the concrete elements of Word form-cell as the document content identification basis, the system according to the cell index of Word table extraction. But this kind of design must be able to deal with two kinds of situations: one of each word table corresponds to a record in the datasheet, that is, the number of cells fixed case; the other is that a Word table corresponds to a multiple-row record in a datasheet that is a variable number of cells. Now the author developed the system has been completely able to deal with these two situations.
The second is the introduction of the results document. When importing, there are usually two things: one is to import a single outcome document, and the other is to import multiple results documents, which are folders. The import of the result document is actually the problem of extracting the content of Word document, the key of extraction is the extraction of the picture in the result document and the extraction of the content of the result, in which the picture format can only be BMP format. For the details of the results, the ntext type field in SQL Server is used because the content may include elements such as text boxes, tables, pictures, and so on. The Clipboard is used as a medium for the exchange of Word data and datasheet data for the extraction of pictures and details. Another problem when importing is the determination of the contents of a cell, that is, how to determine that the current cell content is required for a data table field.
For a table with a fixed number of cells, the fields in the cell in the Word table and in one record in the datasheet are one by one corresponding, but for a variable number of cells, you must increase the function of the cell content determination. When you import multiple documents at the same time, there are other Word documents in the document or folder that you want to import, so you must identify the documents you wish to import. For the previous template design method, the general recognition method is to identify the bookmark or identify the special characters that are added to a location in the document. However, the defects of these two methods are also obvious, and the identification marks are easily deleted by mistake.
But the basic idea of document recognition is to distinguish the characteristics of document template from other documents. Based on the successful experience of the existing recognition methods, the author proposes the document recognition method: Starting from the characteristics of the results template itself, using three restrictive conditions to judge. First, there are three tables in the results document, the second one is a total of two lines in the results document, and three is the third table in the results document. The above three limitations are sufficient to ensure the correct identification of the results document. Of course, the different results of the template can be based on the specific characteristics of the specific analysis, which is the basic idea of document recognition.
Again, the export of the results document. When you export, you still use cells in Word as the unit of recognition. The most common problem with exporting is that, for multiple records, a Word table should automatically adjust the number of rows based on the number of records, and then merge and split the cells. In the system developed by the author, this problem has been solved successfully. In addition, from the user's point of view, the system also implements the export of the export document in one function will be exported to multiple documents as a document, greatly facilitate the user's browsing and editing.
In order to give full play to Delphi powerful data management function, the system also provides the manual maintenance function, namely the traditional system interface carries on the result the addition and deletion modification function, thus guaranteed the modification content and the export result document consistency, simultaneously also facilitates the inquiry and the statistics.