Table of contents

Report.ScaleHeight 属性 (权限)Report.ScaleHeight Property (Access)

office 365 dev account|上次更新日期: 2018/4/3
2 参与人员

您可以使用ScaleHeight属性时对报表进行打印或预览,或它的输出是使用直线Pset打印方法时指定的页面的垂直度量单位数保存到一个文件中。You can use the ScaleHeight property to specify the number of units for the vertical measurement of the page when the Circle, Line, Pset, or Print method is used while a report is printed or previewed, or its output is saved to a file.读/写 单个Read/write Single.



表达式_一个表示报表对象的变量。_expression A variable that represents a Report object.


默认设置是以缇为单位的报表页面内部高度。The default setting is the internal height of a report page in twips.

您可以通过使用宏或Visual Basic事件过程由节的OnPrint属性设置指定设置ScaleHeight属性。You can set the ScaleHeight property by using a macro or aVisual Basicevent procedure specified by a section's OnPrint property setting.

ScaleHeight属性可用于创建自定义坐标缩放绘图或打印。You can use the ScaleHeight property to create a custom coordinate scale for drawing or printing.例如,语句 ScaleHeight = 100将节的内部高度定义为 100 个单位或高度的百分之一作为一个垂直度量。For example, the statement ScaleHeight = 100 defines the internal height of the section as 100 units, or one vertical unit as one one-hundredth of the height.

使用ScaleMode属性可以定义一个基于标准测量单位的如磅、 像素、 字符、 英寸、 毫米或厘米刻度。Use the ScaleMode property to define a scale based on a standard unit of measurement, such as points, pixels, characters, inches, millimeters, or centimeters.

ScaleHeight属性设为正值,使增加值从上到下的坐标。Setting the ScaleHeight property to a positive value makes coordinates increase in value from top to bottom.将其设为负值,使增加值从底部到顶部的坐标。Setting it to a negative value makes coordinates increase in value from bottom to top.

通过使用这些属性和相关的ScaleLeft距离属性,您可以设置自定义的坐标系统使用正值和负值的坐标。By using these properties and the related ScaleLeft and ScaleTop properties, you can set up a custom coordinate system with both positive and negative coordinates.所有这四个比例属性按以下方式使用 ScaleMode 属性进行交互:All four of these Scale properties interact with the ScaleMode property in the following ways:

  • 任何其他扩展属性设置为任何值自动设置ScaleMode属性为 0。Setting any other Scale property to any value automatically sets the ScaleMode property to 0.

  • ScaleMode属性设置为大于 0 的ScaleHeightScaleWidth属性将更改为新的度量单位,并将ScaleLeft距离属性设置为 0。Setting the ScaleMode property to a number greater than 0 changes the ScaleHeight and ScaleWidth properties to the new unit of measurement and sets the ScaleLeft and ScaleTop properties to 0.此外, CurrentX当前 属性设置更改以反映当前点的新坐标。Also, the CurrentX and CurrentY property settings change to reflect the new coordinates of the current point.

您还可以使用Scale方法将ScaleHeightScaleWidthScaleLeft距离属性设置在一个语句中。You can also use the Scale method to set the ScaleHeight, ScaleWidth, ScaleLeft, and ScaleTop properties in one statement.

请注意ScaleHeight属性不一样的高度属性。Note The ScaleHeight property isn't the same as the Height property.


下面的示例使用Print方法在 report1 的报表上显示文本。The following example uses the Print method to display text on a report named Report1.它使用 TextWidthTextHeight 方法来使文本居中垂直和水平。It uses the TextWidth and TextHeight methods to center the text vertically and horizontally.

Private Sub Detail_Format(Cancel As Integer, _ 
 FormatCount As Integer) 
 Dim rpt as Report 
 Dim strMessage As String 
 Dim intHorSize As Integer, intVerSize As Integer 

 Set rpt = Me 
 strMessage = "DisplayMessage" 
 With rpt 
 'Set scale to pixels, and set FontName and 
 'FontSize properties. 
 .ScaleMode = 3 
 .FontName = "Courier" 
 .FontSize = 24 
 End With 
 ' Horizontal width. 
 intHorSize = Rpt.TextWidth(strMessage) 
 ' Vertical height. 
 intVerSize = Rpt.TextHeight(strMessage) 
 ' Calculate location of text to be displayed. 
 Rpt.CurrentX = (Rpt.ScaleWidth/2) - (intHorSize/2) 
 Rpt.CurrentY = (Rpt.ScaleHeight/2) - (intVerSize/2) 
 ' Print text on Report object. 
 Rpt.Print strMessage 
End Sub

另请参阅See also


报表对象Report Object

© 2018 Microsoft