调用WORD中的"字体"对话框,切换其他应用程序窗口后发现"假死","字体"对话框藏到后面,怎么能让

  • 主题发起人 主题发起人 chengxianle
  • 开始时间 开始时间
C

chengxianle

Unregistered / Unconfirmed
GUEST, unregistred user!
调用WORD中的&quot;字体&quot;对话框,切换其他应用程序窗口后发现&quot;假死&quot;,&quot;字体&quot;对话框藏到后面,怎么能让他保持在最前???急!急!急!(100分)<br />procedure TForm1.btn8Click(Sender: TObject);
var
ItemIndex: OleVariant;
ThiswdStyleNormal : OleVariant;
NormalTextStyle : OleVariant;

savechanges, originalformat, routedocument : OleVariant;
//ItemIndex: OleVariant;
temporary: OleVariant;
i: Integer;
//FileName: string;
vis: olevariant;
timeout : olevariant;
FileName, ConfirmConversions, ReadOnly, AddToRecentFiles,
PasswordDocument, PasswordTemplate, Revert, WritePasswordDocument, WritePasswordTemplate,
Format, Encoding, Visible, OpenAndRepair, DocumentDirection, NoEncodingDialog, XMLTransform : OleVariant;
begin
try
ItemIndex := 1;
FileName := 'F:/学习资源/标书相关/OleTest/ABC4.doc';
vis := True;
ConfirmConversions:= EmptyParam ;
ReadOnly := EmptyParam ;
AddToRecentFiles := EmptyParam ;
PasswordDocument := EmptyParam ;
PasswordTemplate := EmptyParam ;
Revert := EmptyParam ;
WritePasswordDocument := EmptyParam ;
WritePasswordTemplate := EmptyParam ;
Format := EmptyParam ;
Encoding := EmptyParam ;
Visible := EmptyParam ;
OpenAndRepair := EmptyParam ;
DocumentDirection := EmptyParam ;
NoEncodingDialog := EmptyParam ;
XMLTransform := EmptyParam ;

WordApplication1.Visible := false;

WordApplication1.Documents.Open(FileName, ConfirmConversions, ReadOnly, AddToRecentFiles,
PasswordDocument, PasswordTemplate, Revert, WritePasswordDocument, WritePasswordTemplate,
Format, Encoding, Visible);

WordApplication1.DisplayAlerts :=wdAlertsNone;
WordApplication1.Application.Dialogs.Item(wdDialogFormatFont).Show(EmptyParam);

WordApplication1.Visible := false;

WordDocument1.CleanupInstance ;

WordApplication1.Disconnect;
except
on E: Exception do
begin
ShowMessage(E.Message);
WordApplication1.Disconnect;
end;
end;
end;
 
先用OleContainer打开,然后再调用WordApplication对象就行。
 
接受答案了.
 
后退
顶部