ComponentOne VSView Reporting Edition
Load Method

Loads a report from an XML report definition file.

Syntax

[form!]VSReport.Load FileName As String, ReportName As String

Remarks

Report definition files are XML files created by applications such as the Report Designer. You can write applications to create report definition files as well; the format is quite simple.

The parameters for the Load method are described below:

FileName As String

This parameter contains the full name of the XML report definition file.

ReportName As String

This parameter specifies the report you want to retrieve. You can get a list of reports available in the file using the GetReportInfo method. The ReportName parameter is case-insensitive, so you can use "yearly sales" to retrieve a report called "Yearly Sales".

For example, the following code populates a ComboBox control with all the reports in a file:

' get a tab-separated list of the reports

' in the report definition file

s = App.Path & DataFileName

sList = vsr.GetReportInfo(s, vsrRIList)

vList = Split(sList, vbTab)

 

' populate list box

cmbReport.Clear

For i = 0 To UBound(vList)

    cmbReport.AddItem vList(i)

Next

The following code loads and renders a report when the user picks it from the list:

Private Sub cmbReport_Click()

 

  ' make sure control is ready

  If vsr.IsBusy Then Beep: Exit Sub

 

  ' load report from XML file

  s = App.Path & DataFileName

  vsr.Load s, cmbReport.Text

 

  ' render report

  vsr.Render vp

 

End Sub

You can also load reports at design time, using the "Load Report" property page. If you load a report this way, it is saved as part of the control data, and becomes part of your application. In this case, you don't need to distribute any report definition files. If you want to make several reports available to your users, and don't want to distribute a report definition file, use multiple controls on the form, and load a different report into each one at design time.

The control does not have any methods for saving report definition files. However, because the control uses XML as its native format, you can easily write code to generate your own report definition files. This is what the Reports Designer application does.

 

 


Copyright (c) GrapeCity, inc. All rights reserved.

Product Support Forum  |  Documentation Feedback