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;