```
Sub AutoPadding1(ViewName As View,LineSpaceRate)
Dim HeightOfLine1,HeightOfLine2,HeightOfLine3,HeightOfLine4,NumberOfLine,TopPadding,Dif,TotalSpace As Float
Dim lbl As Label
lbl=ViewName
Dim MeasureHeight As StringUtils
Dim JavaMeasureHeight=lbl As JavaObject
Dim jo=lbl As JavaObject
'----------------------------------------------------------------------
HeightOfLine1=(JavaMeasureHeight.RunMethod("getLineHeight",Null))/LineSpaceRate 'height of one line before set line space
HeightOfLine2=HeightOfLine1*LineSpaceRate 'height of one line after set line space
Dif=HeightOfLine2-HeightOfLine1 'Difference
HeightOfLine3=JavaMeasureHeight.RunMethod("getLineHeight",Null) 'height of one line with line space
HeightOfLine4=(MeasureHeight.MeasureMultilineTextHeight(lbl,lbl.Text))*LineSpaceRate 'height of lines with line space
NumberOfLine=HeightOfLine4/HeightOfLine3 'number of lines
TotalSpace=(NumberOfLine-1)*Dif 'sum of spaces
TopPadding=TotalSpace+(NumberOfLine*HeightOfLine1) 'sum of spaces and lines height - last line space
TopPadding=(lbl.Height-TopPadding)/2 'free space in top and bottom
jo.RunMethod("setPadding",Array As Object(0,TopPadding,0,0))
End Sub
```