delphi2007 教程

delphi2007 教程

首页 新随笔 联系 聚合 管理
  1013 Posts :: 0 Stories :: 28 Comments :: 0 Trackbacks
高手请进,关于word的问题,高分奉送 Delphi / Windows SDK/API
http://www.delphi2007.net/DelphiDB/html/delphi_20061218135544240.html
我做了一个word文档的模版,里面有一个表格,如何才能把word打开,并把数据库的内容插到word表格里面去啊,怎么样才能插进去啊?高手指教!!!!!给20分

uses  
      Word2000;  
   
  var  
    _Cell:   Cell;  
    Idx:   Integer;  
    Row:   Integer;  
    Col:   Integer;  
   
  begin  
    ...........  
    ADOQuery.Open;  
    for   Row   :=   1   to     ADOQuery.RecordCount   do  
    begin  
        for   Col   :=   1   to     ADOQuery.FieldCount   do  
        begin  
            _Cell   :=   WordDocument.Tables.Item(Idx).Cell(Row,   col);  
            _Cell.Range.Text   :=   ADOQuery.Fields[Col   -1].Value;  
        end;  
        ADOQuery.Next;  
    end;  
  .............

posted on 2009-02-19 16:54 delphi2007 阅读(50) 评论(0)  编辑 收藏 引用
只有注册用户登录后才能发表评论。