delphi操作word基类,插入表格,分页符,日期,页码,替换,图片

unit utMyword;(*By 闫磊 编写 2004.09.06 Email:landgis@126.com yanleigis@21cn.com*)interfaceuses word2000, ActiveX, Variants, Dialogs, SysUtils;type    TMyWord = class(TObject)    private
摘要由CSDN通过智能技术生成

unit utMyword;

(*

By 闫磊 编写 2004.09.06 Email:landgis@126.com yanleigis@21cn.com

*)

interface

uses word2000, ActiveX, Variants, Dialogs, SysUtils;

type

    TMyWord = class(TObject)

    private

    FWord: TWordApplication;        //word对象

    FDoc: TWordDocument;            //文档对象

    procedure connectword();

    public

    //换行

    procedure AddReturn();

    //设置字体

    procedure SetFont(FontName: string; FontSize: Integer;

    FontBold: Boolean = False; FontUnderline: Boolean = False);

    //插入表格

    function AddTable( Col , Row: Integer): Table;

    //设置背景色

    procedure SetTableBack(BackColor: ToleEnum);

    //鼠标下移

    procedure MoveDown(num: Integer = 1);

    //选择下移

    procedure SelectDown(num: Integer = 1);

    //鼠标上移

    procedure Moveup();

    //鼠标右移

    procedure MoveRight(num: Integer = 1);

    //选择右移

    procedure SelectRight(num: Integer = 1);

    //写字

    procedure WriteText(Text: string);

    //按样式插入一行记录

    //AddLine "备注","正文"

    //AddLine 'kk',"标题 1"

    procedure AddLine(S: string; PStyle: olevariant);

    procedure AlignLine(Align: ToleEnum);

    //插入分页符

    procedure insertPage();

    //插入插入页码

    procedure insertPagenum();

    //插入日期

    procedure insertDate();

    //设置表格一列宽度

    procedure SetTable(PTable: Table; ColumnIdx: Integer; Width: Integer);

    //设置表格一列高度

    procedure SetTableheight(PTable: Table; RowIdx: Integer; height:

    Integer);

    //插入目录

    procedure InsertContents();

    //创立书签

    procedure createBookMark(BookMarkName: string);

    //移动到标签

    procedure GotoBookMark(BookMarkName: string);

    //粘贴

    procedure paste();

    //替换

    procedure Replace(Source, Target: string);

    //保存

    procedure Save(FileName: string);

    //插入图片

    procedure AddPicture(FileName: string);

    //移到最后

    procedure MoveEnd();

    //合并

    procedure CellsMerge();

    constructor Create;

    destructor Destroy; override;

end;

 

//function Myword: TMyWord;

implementation

//var

//    FMyWord: TMyWord;

{function Myword: TMyWord;

begin

    if FMyWord = nil then

    begin

        FMyWord := TMyWord.Create;

    end;

 

    Result := FMyWord;

end;

  • 1
    点赞
  • 14
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值