检查页面上的页面长度和位置 [英] Check page length and position on page

查看:88
本文介绍了检查页面上的页面长度和位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在以编程方式创建Word文档。我想让所有段落整齐地放在一个页面上而不会中断。


我需要检查光标的当前位置(即它相对于页面的哪一行),然后计算是否页面上有足够的行来容纳下一段(我知道每段中的行数)。如果
空间不够,我会抛出一个分页符。


任何人都可以帮我找到页面上的一行并确定是否有足够的空间用于下一段?



谢谢 

解决方案

表达式

 Selection.Information(wdFirstCharacterLineNumber)

返回第一行的行号选择中的字符。表达式

 Selection.Information(wdVerticalPositionRelativeToPage)

返回选择距离顶部页面的点数(1英寸= 72点)。


ActiveDocument.PageSetup.PageHeight和  ActiveDocument.PageSetup.BottomMargin可用于确定页面可用区域的底部


I am creating a Word document programatically. I want all paragraphs to fit neatly on one page without breaks.

I need to check the current position of the cursor (i.e. which line it is on relative to the page) and then calculate whether there are enough lines left on the page to accommodate the next paragraph (I know the number of lines in each paragraph). If there is not enough space I will throw a page break.

Can anyone help me with finding the line on the page and working out if there is enough space left for the next para?

Thanks 

解决方案

The expression

Selection.Information(wdFirstCharacterLineNumber)

returns the line number of the first character in the selection. The expression

Selection.Information(wdVerticalPositionRelativeToPage)

returns the distance of the selection from the top of the page in points (1 inch = 72 points).

ActiveDocument.PageSetup.PageHeight and ActiveDocument.PageSetup.BottomMargin can be used to determine the bottom of the usable area of the page.


这篇关于检查页面上的页面长度和位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆