摘要
通过VisualC++6.0编程,使用ADO技术动态打开数据库,可任意选择数据库中的记录和字段。用Office宏技术,通过将录制的宏与VisualC++6.0程序中的对应函数进行比较,可知道函数参数类型等信息,从而可实现对Word的控制,能够将任意字段的标识字符串插入到含有不规则表格的Word文档中的任意位置。之后将原文档看作一个模板,用各字段中的数据去替换相应的标识字符串,并生成新文档;若指定多条记录,每条记录生成一个新文档,即实现了批处理。最终用Word的打印排版功能完成不规则表格化打印。
How to print database records and fields at will in irregular tables is discussed by Visual C ++ 6.0 programming. Database is opened dynamically by ADO technology; database records and fields can be selected at will. Using the macro technology of Microsoft Office, operations in the Word can be recorded in Visual Basic scripts.By comparing with the Visual C ++ 6.0 corresponding functions, types of function parameters are known, and thus, the program can control the Word. Mark strings of specified fields are inserted at given positions in Word document including irregular tables. Then the document is used as a template, each mark string is replaced by its content, and saved as a new document. If many records are selected, for each record a new document is produced; that is to say, the program can do the replacement work in batches. Finally, the powerful printing and composing abilities of the Word are used to print database at will.
出处
《河南科技大学学报(自然科学版)》
CAS
2007年第1期38-40,共3页
Journal of Henan University of Science And Technology:Natural Science
基金
国家十五科技攻关项目
河南太阳能与建筑结合试点示范项目(2002BA405B01-403-1)