Delphi realizes automatic merging of same type document

Source: Internet
Author: User

1. Introduction

Recently, bought a 900 English learning CD-ROM, because there is no corresponding written material, I would like to own the CD documents extracted, can open a CD, found that although each sentence has a corresponding detailed text material, But each sentence is stored separately in a separate RTF document (Sentence001.rtf to SENTENCE900.RTF), which is cumbersome to use, so you want to merge all 900 sentence patterns together, merging 900 separate documents into one document.

2. How to Solve

2.1 Conventional methods

The first idea is to take advantage of the document merge feature of Word to insert another Word document into the currently open document. The specific steps are:

① opens sentence001 (in the dialog for opening a file, the file type chooses Rich Text format).

② position the cursor at the end of the document.

③ Click the "File ..." menu item in the Insert menu.

④ in the Open Insert File dialog box, enter the name of the file you want to insert in the file name box: sentence002.rtf

This combines the two documents of the first two sentences into a single document and exists as a sentence001.rtf. Obviously, as long as you repeat the above process, you will eventually merge the 900 sentence patterns scattered in 900 documents into one document. The process is simple, but time-consuming, and therefore applies only to a handful of document merging operations.

The application of 2.2 Delphi in document merging

Taking into account the following:

(1) Each file name to be merged with "sentence" Start, followed by 001, 002,...,900, very regular.

(2) When merging, each time the contents of the new document are added to the end of the original document, inserted at the end of the original document, the insertion position is fixed.

There is no quicker way to think about it, and it's better for the computer to automatically help complete the merge process.

① idea: In Delphi, select a control that can accept and handle multi-line text, first read sentence001.rtf content into it, then loop, then Sentence002.rtf, The contents of the sentence003.rtf are read in and appended to the end, and the contents of the control are finally saved to another file.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.