C
caojianli
Unregistered / Unconfirmed
GUEST, unregistred user!
下面代码中加粗的行同时出现后系统停止响应(即上移两行至上页和统计最新页数的代码)!把上面加粗的两行去掉通过,把下面的加粗的两行去掉通过(可这两行不能去掉,去掉后不能及时统计总页数,不能实现我的要求)!可我的要求是在每页页尾插入两行,页头插入两行!
varword.Selection.HomeKey(Unit:=wdStory);
z:=newdoc.BuiltInDocumentProperties[wdPropertyPages].Value;//获得总页数
i:=2;
while i<=z do
begin
varword.Selection.GoTo(What:=wdGoToPage, Which:=wdGoToFirst, Count:=i, Name:='');//定位I指定的页数
varword.Selection.MoveUp(Unit:=wdLine, Count:=2);
varword.Selection.HomeKey(Unit:=wdLine);//前移两行至上页倒数第二行首插入四行
varword.Selection.insertbefore(table2['bt1']+'人签字: 记录人签字: '+chr(13));
varword.Selection.insertafter('被'+table2['bt1']+'人签字并押印: '+formatdatetime('yyyy年mm月dd日',cxdate1.Date));
varword.Selection.insertafter(chr(13)+table2['bt1']+'笔录附页'+chr(13));
varword.Selection.font.name:='仿宋_GB2312';
varword.Selection.font.size:=16;
varword.Selection.insertafter('共ZYS页第DQY页'+chr(13));
varword.Selection.HomeKey(Unit:=wdStory);//本行及下一行统计最新页数
z:=newdoc.BuiltInDocumentProperties[wdPropertyPages].Value;
i:=i+1;
end;
varword.Selection.HomeKey(Unit:=wdStory);
z:=newdoc.BuiltInDocumentProperties[wdPropertyPages].Value;//获得总页数
i:=2;
while i<=z do
begin
varword.Selection.GoTo(What:=wdGoToPage, Which:=wdGoToFirst, Count:=i, Name:='');//定位I指定的页数
varword.Selection.MoveUp(Unit:=wdLine, Count:=2);
varword.Selection.HomeKey(Unit:=wdLine);//前移两行至上页倒数第二行首插入四行
varword.Selection.insertbefore(table2['bt1']+'人签字: 记录人签字: '+chr(13));
varword.Selection.insertafter('被'+table2['bt1']+'人签字并押印: '+formatdatetime('yyyy年mm月dd日',cxdate1.Date));
varword.Selection.insertafter(chr(13)+table2['bt1']+'笔录附页'+chr(13));
varword.Selection.font.name:='仿宋_GB2312';
varword.Selection.font.size:=16;
varword.Selection.insertafter('共ZYS页第DQY页'+chr(13));
varword.Selection.HomeKey(Unit:=wdStory);//本行及下一行统计最新页数
z:=newdoc.BuiltInDocumentProperties[wdPropertyPages].Value;
i:=i+1;
end;