Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Re-positioning Fields at runtime 1

Status
Not open for further replies.

JBats

Programmer
Aug 3, 2003
127
PH
I want to make a utility program for my report that configures a position of a specific field in rpt. Say, my VB program has a GUI that the user want to configure the position of the field in the report. He must enter a position number (left, down, up, right) then the VB program will command the crystal report rpt to position those fields in the specified numbers given by the user. How can I do this? Please Help.

JBats
Good is not better if not than best...
 
Depends on your version of Crystal, and the method of the Print Engine you're using. If you're not using the RDC, I don't think you can do it. With the RDC, each Field on the report has a Top and Left property that can be set at run-time or design-time. The height of the Section containing the field is automatically adjusted to accomodate the movement of the Field object.

-dave
 
Thanks vidru for your response with my question.

I am using a Crystal Report 8.5.0.217 and my print engine is ActiveX Designer Run Time Library (CRAXDRT engine). Is there a way for me to set the properties of the fileds? If not, can anybody give me an idea on how to resolve this problem.

Any help would be highly appreciated.

JBats

JBats
Good is not better if not than best...
 
OK, here's a simple example using the [Date Range Formula] sample report (C:\Program Files\Seagate Software\Crystal Reports\Samples\En\Reports\Feature Examples\Date Range Formula.rpt).

In VB, add the Crystal Report Viewer compnonent, and a reference to the Crystal Reports 8.5 ActiveX Designer Run Time Library (craxdrt.dll).

Scenario:
I want to move the {Orders.Order ID} field in the Details A section a bit to the left...
Code:
'General Declarations
Dim crxApp As New CRAXDRT.Application
Dim crxRpt As CRAXDRT.Report
Dim crxSection As CRAXDRT.Section
Dim crxFieldObj As CRAXDRT.FieldObject

Private Sub Form_Load()
Set crxRpt = crxApp.OpenReport("C:\Program Files\Seagate Software\" & _
    "Crystal Reports\Samples\En\Reports\Feature Examples\" & _
        "Date Range Formula.rpt")
Set crxSection = crxRpt.Sections("Da")
Debug.Print crxSection.ReportObjects.Count
For Each object In crxSection.ReportObjects
    If object.Kind = crFieldObject Then
        Set crxFieldObj = object
            If crxFieldObj.Field.Name = "{Orders.Order ID}" Then
                [COLOR=red]crxFieldObj.Left = crxFieldObj.Left - 150[/color]
            End If
    End If
Next

CRViewer1.ReportSource = crxRpt
CRViewer1.ViewReport

Set crxApp = Nothing
Set crxRpt = Nothing
Set crxSection = Nothing
Set crxFieldObj = Nothing

End Sub
-dave
 
Thanks again vidru, i will try this code then will let you know for the result. thanks again

JBats

JBats
Good is not better if not than best...
 
great job vidru here's a star for you.

jbats

JBats
Good is not better if not than best...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top