word整体放大、缩小字体

来源:互联网 发布:阶级 知乎 编辑:程序博客网 时间:2024/05/01 06:46

用宏录制,就能看见实现代码

以下为delphi实现

放大字体

procedure ZoomInFontSize();var  doc: _Document;  I: Integer;  KeyType, ExtParam: OleVariant;begin  if FZooming then    Exit;      FZooming := True;  doc := (FOfficeCtrl.ActiveDocument as _Document);  doc.Application.Selection.WholeStory;  for I := 1 to 9 do    doc.Application.Selection.Font.Grow;  KeyType := wdStory;  ExtParam := EmptyParam;  doc.Application.Selection.HomeKey( KeyType, ExtParam );         end;

缩小字体

procedure ZoomOutFontSize;var  doc: _Document;  I: Integer;  KeyType, ExtParam: OleVariant;begin  if not FZooming then    Exit;  FZooming := False;  doc := (FOfficeCtrl.ActiveDocument as _Document);  doc.Application.Selection.WholeStory;  for I := 1 to 9 do    doc.Application.Selection.Font.Shrink;  KeyType := wdStory;  ExtParam := EmptyParam;  doc.Application.Selection.HomeKey( KeyType, ExtParam );end;



原创粉丝点击