How to lead the records in the database in Delphi in Word

zhaozj2021-02-16  51

How to lead the records in the database in Delphi in Word

No .: QA004684 Establishment Date: On May 18, 2003, final modification date: May 20, 2003 Category:

Delphi - Office Development Delphi - Database

PQ: The system I use is Win2000. Delphi is a version 6.0 version. Word2000 Ask: In Delphi, you want to introduce records in the database to Word, build a table, to display two tables in parallel on one page in Word, how to What is achieved?

Reply:

My reply to this question is this: I have dealt with similar problems, but I put the data into TXT. Also draw form form, but I think it is the same. What is important is the types you set to TStrings such as: var txtstr: tstrings; begin txtstr: = tstringlist.create; txtStr.Append ('─────────────────────────── ┬──────────── '); // 0 line TXTSTSTSTSTSTR.APpend (' Name │ '); // First line .... // From the database to TXTADO While Not TXTADO.EOF Do Begin TxtStr [1]: = TXTSTSTR [1] Format ('% 8S', [TXTADO.FIELDBYNAME ('XM'). Asstring]) '│'; txtado.next; end; host Note : Complete this problem, need two steps, one is to read the data in the database, and the other is to use the Automation technology to control Word to complete the platyboard and save it as a Word file or print. The first step has been introduced, the second step, please refer to: QA003053 "Control Word97" with Delphi 4.0 ". Loga's opinion: If it is VB, you can open the recording macro in Word, then manually add database records, and VBA can automatically write code. A hole is for reference only. Related questions: QA000836 "How to know how the Excel97 command set" QA001381 "How to control Word and Excel" Qa003819 "how to use OLE to add text in VB

This issue is replied by Huang Wei.

转载请注明原文地址:https://www.9cbs.com/read-22649.html

New Post(0)