注册 登录
编程论坛 VFP论坛

为什么word表格最后一页页码不在表格的正中间

王咸美 发布于 2025-05-31 17:41, 140 次点击
我有一个dbf表格有 139条记录,每页有40条记录,每页表格下面均有页码,其他页页码插入位置都正确,唯独最后一页页码不在表格的正中间,现将部分代码贴上,请高手指教,万分感谢!!!
 
附:代码(部分)
......
wide=2
FOR i=1 to FCOUNT()
  wide=wide+FSIZE(FIELD(i))+2
ENDFOR
kg=(wide-11)/2

*!* 插入空白行作为每页的标题行
xx=40
mPage=IIF(MOD(RECCOUNT(),xx)<>0,INT(RECCOUNT()/xx)+1,RECCOUNT()/xx)
FOR   i=1  TO   mPage
  aa=(i-1)*xx+i
  loword.ActiveDocument.Tables(1).Cell(aa,1).select
  loword.selection.InsertRows
ENDFOR

*!* 插入分页符
FOR   i=1   TO   mPage-1
  loword.ActiveDocument.Tables(i).Cell(xx+2,1).select
  loword.selection.InsertBreak(7)
ENDFOR

*!* 在每页表格下面插入页码
page=0
FOR   i=1   TO   mPage
  loword.ActiveDocument.Tables(i).Cell(xx+2,1).select
  page=page+1
  loword.selection.MoveDown(5,1,.F.)
  loword.selection.InsertAfter(SPACE(kg)+"第"+ALLTRIM(STR(page))+"页/共"+ALLTRIM(STR(mPage))+"页")
  loword.selection.Font.Size=10
  loword.selection.Font.Name="楷体_GB2312"
ENDFOR



0 回复
1