用宏录制,就能看见实现代码
以下为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;