Consultor Eletrônico



Kbase 17661: Actuate - How to implement CanGrow Fields
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   5/10/1998
Actuate - How to implement CanGrow Fields

CanGrow Fields Within Reports

To implement CanGrow fields in the Before frame of a section,
the height of the frame needs to be calculated before the
Before frame gets added, because the size of the Before
frame is set before it reads any datarows.

You can override the Fetch method in the DataStream to see how
long the value was that you want to stretch your frame to
display. Then you update a variable in the report component
that both the Before frame and the display control used to
calculate their height. Because the Fetch method does not
know the height or width of the control being used to display
the information, this information must be added into the Fetch
method as integer values (use the height in twips).

NewReportApp
Variables
StretchSize - Integer, Static

DataSource
Methods
Function Fetch( ) As AcDataRow
Set Fetch = Super::Fetch( )
If Fetch Is Nothing Then
Exit Function
End If

Dim CurrentRow As DataRow
Set CurrentRow = Fetch

If IsNull(CurrentRow.orders_issue) Then
NewReportApp::StretchSize = 0
Exit Function
End If

Dim AverageCharactersPerLine As Integer
'Set the average number of characters per line
AverageCharactersPerLine = 11
Dim HeightofLine As Integer
'Set the height of the control you are using to
display the text
HeightOfLine = 360
Dim LengthOfString As Integer
'Get the string length for the control you will
stretch the Before frame to fit
LengthOfString = Len(CurrentRow.orders_issue)

Dim NumberOfCarriageReturns As Integer
Dim X As Integer
Dim NumberOfLines As Integer

'Determine the number of carriage returns for the
field in the data row you want
NumberOfCarriageReturns = 0
For X = 1 To LengthOfString
If Mid$(CurrentRow.orders_issue,X,1) = Chr$(13)
Then
NumberOfCarriageReturns = NumberOfCarriageReturns + 1
End If
Next

'Determine the number of lines required to print the text
NumberOfLines = LengthOfString/AverageCharactersPerLine

'Set the NewHeight variable for the Before frame to the
height you want it to be
NewReportApp::StretchSize = &
(NumberOfLines + NumberOfCarriageReturns) * HeightOfLine

End Function

BeforeFrame
Methods
Sub Start( )
Super::Start( )
Size.Height = Size.Height + NewReportApp::StretchSize
End Sub

Issue control (within BeforeFrame)
Methods
Sub Start( )
Super::Start( )
Size.Height = NewReportApp::StretchSize
End Sub


Progress Software Technical Support Note # 17661