就是关于在OLE控件里的word文档的打印预览问题。(其实不算什么难题,我以前解决过的,现在不知怎么的又不行了)急!
以前我这样写的:
OleContainer1.DoVerb(0);
OleContainer1.OleObject.PrintPreview;这样就可以了,现在不知为什么出现“所需视图无效”的错误。请各位帮忙!
以前我这样写的:
OleContainer1.DoVerb(0);
OleContainer1.OleObject.PrintPreview;这样就可以了,现在不知为什么出现“所需视图无效”的错误。请各位帮忙!
现找一段源程序给你:
////1.var
WordApp : Variant;begin
WordApp:=CreateOLEObject('Word.Application');
WordApp.Visible:=false; // it's the default, but in case you want to display
// it you just set the Visible to true
WordApp.PrintOut(FileName:="c:\config.sys", Range:=wdPrintAllDocument,
Item:=wdPrintDocumentContent, Copies:=1, Pages:="",
PageType:=wdPrintAllPages, Collate:=True, Background:=True,
PrintToFile:=False); //print out the file
WordApp.Quit;
WordApp:=Unassigned;
end;