to::::jjpan(皮皮lu) 我用录制宏的工具录制之后,有一句话翻译不过来!! 下面是我的代码:请你看看,帮忙改一下 NormalTemplate.AutoTextEntries("第 X 页 共 Y 页").Insert(PaperDocument.ActiveWindow.Selection.Range);//(这句话汇报错!!!!!) 就是上面这句话了If (PaperDocument.ActiveWindow.ActivePane.View.Type_=wdNormalView) Or (PaperDocument.ActiveWindow.ActivePane.View.Type_=wdOutlineView) Then begin PaperDocument.ActiveWindow.ActivePane.View.Type_ := wdPrintView; End; PaperDocument.ActiveWindow.ActivePane.View.SeekView:= wdSeekCurrentPageFooter; NormalTemplate.AutoTextEntries("第 X 页 共 Y 页").Insert(PaperDocument.ActiveWindow.Selection.Range);//(这句话汇报错!!!!!) PaperDocument.Application.Selection.TypeText('我的实验'); PaperDocument.Application.Selection.ParagraphFormat.Alignment := wdAlignParagraphCenter; PaperDocument.ActiveWindow.ActivePane.View.SeekView:=wdSeekMainDocument;谢谢!!!!谢谢!!!!谢谢!!!!谢谢!!!!谢谢!!!!谢谢!!!!谢谢!!
Selection.TypeText Text:="fgsf"
ActiveWindow.ActivePane.View.SeekView = wdSeekMainDocument
我用录制宏的工具录制之后,有一句话翻译不过来!!
下面是我的代码:请你看看,帮忙改一下
NormalTemplate.AutoTextEntries("第 X 页 共 Y 页").Insert(PaperDocument.ActiveWindow.Selection.Range);//(这句话汇报错!!!!!)
就是上面这句话了If (PaperDocument.ActiveWindow.ActivePane.View.Type_=wdNormalView) Or (PaperDocument.ActiveWindow.ActivePane.View.Type_=wdOutlineView) Then
begin
PaperDocument.ActiveWindow.ActivePane.View.Type_ := wdPrintView;
End;
PaperDocument.ActiveWindow.ActivePane.View.SeekView:= wdSeekCurrentPageFooter;
NormalTemplate.AutoTextEntries("第 X 页 共 Y 页").Insert(PaperDocument.ActiveWindow.Selection.Range);//(这句话汇报错!!!!!)
PaperDocument.Application.Selection.TypeText('我的实验');
PaperDocument.Application.Selection.ParagraphFormat.Alignment := wdAlignParagraphCenter;
PaperDocument.ActiveWindow.ActivePane.View.SeekView:=wdSeekMainDocument;谢谢!!!!谢谢!!!!谢谢!!!!谢谢!!!!谢谢!!!!谢谢!!!!谢谢!!
procedure TForm1.Button1Click(Sender: Tobject);
var MSWord: Variant;
begin
MSWord := CreateOLEObject('Word.Application');//连接Word
MSWord.Documents.Open(FileName:='d:\test.doc', ReadOnly:=True);//打开外部Word文档
MSWord.Visible := 1;//是否显示文件编辑
MSWord.ActiveDocument.Range(Start:=0, End:=0);//开始改变的启止位置
MSWord.ActiveDocument.Range.InsertAfter(Text:='Title');//在Word中增加字符'Title'
MSWord.ActiveDocument.Range.InsertParagraphAfter;
MSWord.ActiveDocument.Range.Font.Name := 'Arial';//字体名称
MSWord.ActiveDocument.Range.Font.Size := 24;//字体大小
end;
http://expert.csdn.net/Expert/topic/1855/1855791.xml?temp=.9078333
解决
uses word2000;var
vWdFieldNumPages, vwdFieldPage :OleVariant;
begin
,,,
vWdFieldNumPages := wdFieldNumPages;
vwdFieldPage := wdFieldPage;
wordApplication.Selection.Fields.Add(vWdFieldNumPages, ...)就此结题谢谢things(平)!!!谢谢things(平)!!!谢谢things(平)!!!谢谢things(平)!!!谢谢things(平)!!!谢谢things(平)!!!谢谢things(平)!!!谢谢things(平)!!!